|
wow. uh, that seems like an install problem. your code *looks* correct (C# will 'BOX' the int as an object). try casting 'stateinfo' to int instead of Int32.
Did you have beta versions of VS2005 installed previously?
|
|
|
|
|
Hi
I need to print the report which I am creating using crystal reports. I am getting the list of attached printers and displaying in a drop down list as follows:
for( int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++ )
{
string printerName = PrinterSettings.InstalledPrinters[i].ToString();
ddlPrinters.Items.Add( printerName );
}
This particular piece of code displays the list of printers on server side. I instead want the list of printers on client side. Can someone please suggest how to do that?
Thanks in advance
|
|
|
|
|
I take it this is a WEB application and not Windows Forms???
If so, then you can't do this in your C# code since the server-side has absolutely zero access to the client. You'll have to use client-side JavaScript to do something like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In Javascript, I know window.print() is used but it prints the complete page.
1. Is their anyway in javascript to get the printer names on client machine ?
1. What do we do in javascript to print only the part of page and not the complete page ?
Thanks
|
|
|
|
|
I have no idea.
In theory, JavaScript running in a browser has no access to the list of installed printers.
But, you'd have to ask this in the Web Development forum for a better answer.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, you got question number one, and question number one?
For the first question number one:
No. There is absolutely no way that you can det the printer names using javascript.
For the second question number one:
You can't print a part of a page using javascript. You could take the contents of a part of a page, put it in a page in a new window, and print it.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks
That is what I am doing now. Displaying a part of page that I want to print on a new page and then printing.
|
|
|
|
|
I can create a pointer array, such as:
IntPtr[] openWindows = new IntPtr[100];
But i am unable to store windows hWnds. When i do the following:
openWindows[0] = hWndOfSomeWindow;
And read it back:
Debug.WriteLine(openWindows[0]);
All i get is '0', not the window handle ID. Can someone point our my wrongness here?
|
|
|
|
|
From the deaf silence to my post i assumed that i was doing something foolishly wrong and so i started doing more tests. I finally found that the problem was the incorrect use of an index variable for the IntPtr array. It was not incrementing and so the pointers were all being saved to a single array location. Common error.
|
|
|
|
|
I am trying to read a PDF file so I can convert its data to a readable format that I can then load into a SQL data table. I am not remoting, and I am getting the following error....
Additional information: BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version 825309752.540554042.
My code looks like this....
using System;
using System.IO;
using System.Collections;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
public class App
{
[STAThread]
static void Main()
{
Deserialize();
}
static void Deserialize()
{
// Declare the hashtable reference.
Hashtable myPDFdata= null;
// Open the file containing the data that you want to deserialize.
FileStream fs = new FileStream("MyPDF.pdf", FileMode.Open);
try
{
BinaryFormatter formatter = new BinaryFormatter();
// Deserialize the hashtable from the file and
// assign the reference to the local variable.
myPDFdata = (Hashtable) formatter.Deserialize(fs);
}
catch (SerializationException e)
{
Console.WriteLine("Failed to deserialize. Reason: " + e.Message);
throw;
}
finally
{
fs.Close();
}
// To prove that the table deserialized correctly,
// display the key/value pairs.
foreach (DictionaryEntry de in myPDFdata)
{
Console.WriteLine("{0}myPDFdata.", de.Key, de.Value); }
}
}
Or is there a better way of doing this????
Thanks!
Curt
|
|
|
|
|
Guys I'm at a loss!
I don't want wait cursor to be displayed in my app at all. How can I suppress it totally or change the picture of the WaitCursor to Arrow (default) cursor - so that anytime wait cursor is invoked it would show the arrow, hence show no change.
And why doesn't Cursor.Current = Cursors.Arrow; work. It's supposed to set the current cursor, but it does nothing!
Any help is appreciated!
|
|
|
|
|
That all depends on what's causing the wait cursor. If it's a web browser control on your form, then no, you can't stop the wait cursor from happening. The browser control is what' setting the cursor to Busy. So long as the cursor is over that control, it'll show up Busy.
Changing the image of the cursor, as in your workaround, would require changing the image system-wide. A practice I greatly discourage.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"Changing the image of the cursor, as in your workaround, would require changing the image system-wide. A practice I greatly discourage."
I agree. That would be sloppy.
Yes, the WebBrowser control is causing it to fire the cursor change, so how can I prevent that. Can I derive from the WebBrowser control and change it there? There's got to be a way to do this!!!!
|
|
|
|
|
peshkunta wrote: Yes, the WebBrowser control is causing it to fire the cursor change, so how can I prevent that.
There's no way to prevent it. You could create you own class from the WebBrowser class, but you still wouldn't be able to prevent the cursor from changing because it's not the class code that's changing the cursor. It's the Internet Explorer object code that's doing it, and there's no way you can change that.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The WebBrowser object is a control. Why couldn't I make a custom web browser control???
|
|
|
|
|
peshkunta wrote: The WebBrowser object is a control. Why couldn't I make a custom web browser control???
You could, but doing so would require writing your own browser. You could largely bypass doing so by using the firefox codebase, but would inject the GPL into your code as a result.
|
|
|
|
|
The WebBrowser class in .NET is a WRAPPER for the IE COM object.
In order to supply this functionality, you'd have to write your own web browser class, supplying all the HTML rendering code, but does not wrap the IE COM control, which is entirely possible.
Just creating a new class, inheriting from the existing WebBrowser class, will not allow you to do what you want, since you're inheriting from the WebBrowser class, you're also inheriting the COM object that it wraps.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi ! I have a Context Menu associated with my datagrid and I want to remove it or disable some menu option depending on which column the user Right Click (to show the context menu).
Thank you !
Danny Gilbert
Montréal, Canada
|
|
|
|
|
Newly starting on C# I am attempting to use the TreeView to show a set of heirarchically related data items. In VisualC++ I would simply add to each node a pointer to the relevant data structure. I could then dereference the pointer and be directly at the relevant data item.
Is there an equivalent function or alternative method of connecting a treeNode to a class containing the data being displayed?
Your guidance would be much appreciated.
Craig Sheppard
|
|
|
|
|
There are two ways you can achieve what I think you are asking.
The fast and easy way is to use the TreeNode.Tag property to store a reference to whatever the TreeNode is supposed to represent. The Tag property is of type Object so it can hold a reference to anything, that can be good or bad because you can have nodes holding references to different types of objects. It also means you have to cast the reference back to whatever type it's suppose to be when you want to use that object.
The slightly harder way is to derive your own class from TreeNode and add an extra property that holds a reference to the object that the node is supposed to represent. This way allows you to ensure that only the right type of object is represented and saves you the hassle of having to cast everytime you want to access it.
|
|
|
|
|
Thats just the thing I needed to know. Many thanks for that.
craig
|
|
|
|
|
Hi,
I understand the code below. The question is indicated by ////???? ?????////// further down.
Thanks
public class clsName
{
public static string CardId
{
...
}
}
///////???????Please explain why static may be used with the private access modifier??????////////////////
public class clsName
{
private static string CardId
{
...
}
}
Thanks
|
|
|
|
|
Other (static) methods in the class can still access the private static variables, but you can't access them from outside. I.e. clsName.CardId is not accessible from outside the class.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, I understand that, but what is the benefit of having static private for the method?
Thanks
|
|
|
|
|
That's from the Levenshtein distance I programmed recently:
class Levenshtein
{
static private int Minimum(int a, int b, int c)
{
...
}
static public int Difference(string s, string t)
{
array[i, j] = Levenshtein.Minimum ...
}
}
Difference is the only method accessible from outside. Since it's so simple there's no need to create a class instance, so I made it static. But Distance needs a Minimum-method to retrieve a value. This must also be static, but I don't want it to be accessible from outside the class.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|