|
If you want to store two different types like that and they correspond on a one to one basis I would use a dictionary.
Dictionary<string,int> d = new Dictionary<string,int>();
d.Add("Blue", 0x0000FF);
d.Add("Red", 0xFF0000);
d.Add("Green", 0x00FF00);
Console.WriteLine( "Blue is " + d["Blue"]);
Console.WriteLine("\nRed is " + d["Red"]);
Console.WriteLine("\nGreen is " + d["Green"]);
If you are going to have many different and arbitrary classes you probably need to rethink your program before you start plugging them all into an ArrayList, yank em out, and hope you cast correctly.
-- modified at 15:36 Friday 18th August, 2006
|
|
|
|
|
Hi,
You Can Also use hashtable.
Hope This Works.
Nitin...
|
|
|
|
|
hi
how to print multipage in vc# 2005 ? (for example a datagrid with many records).
thanks ..
|
|
|
|
|
Hello
In the PrintPage event there is an e.HasMorePages property. While you draw your graphics -controls, tables, text, etc...- you make sure to check the length of the current page that you've reached.
Once youy start drawing outside the bottom margin you should set this property to true and return. Then the event will be fired again.
Actually this event will keep firing til you set the HasMorePages to false and return. The graphics and drawing part is all on your shoulders.
Why don't you take a look at My Article[^]? Maybe it will help you.
Regards
|
|
|
|
|
I have two forms. One is master form and one is inherited form from master form. How can i inhert a function from master form?. i want to override a function in the master form in the inherited form.
Regards
Hari
|
|
|
|
|
public class BaseForm : System.Windows.Forms
{
public virtual void MyFunction()
{
...
}
}
public class ChildForm : BaseForm
{
public override void MyFunction()
{
...
}
}
|
|
|
|
|
Hello
3 quick, short, direct, well focused answers in a row in less than 30 mins. WOW!! I think that's a record
Someone should make you Programmer of the month.
Regards
|
|
|
|
|
Nader Elshehabi wrote: 3 quick, short, direct, well focused answers in a row in less than 30 mins. WOW!! I think that's a record
You should have been here when Heath Stewart hung around the C# forum. Now there was a guy who could go through 20 questions in 30 minutes all with precise, detailed and accurate answers. He works for Microsoft now and doesn't have so much time. He pops in now and again, but not very often.
|
|
|
|
|
Hello
I read the bio of the man. He is quite a guy! and 9 THOUSAND messages!!! How did he do that?!!
Last message in the C# forum was 7 months ago though.. Too bad!
Regards
|
|
|
|
|
I have removed the contorl title bar from my form. I have put a usercontrol there instead of that. Now when i drag it the form should move accordingly. How can i do that?
regards
hari
aspspider.net/rkharikrishnan
|
|
|
|
|
Use the event OnMouseDown for detecting mouse click, then use OnMouseMove to get the mouse pointer location, from mouse pointer location you can count the x and y for the property Location.
|
|
|
|
|
|
How can get memory status of the system using C#
Memory status means i need to get aviable physical memory, total physical memory etc.
Please help me
Regards
Hari
aspspider.net/rkharikrishnan
|
|
|
|
|
Find all what you want there....
ManagementObjectSearcher m1 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
foreach(ManagementObject mo in m1.Get())
{
foreach(PropertyData pdc in mo.Properties)
{
Console.WriteLine(pdc.Name + " = " + pdc.Value);
}
}
ManagementObjectSearcher m2 = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
foreach (ManagementObject mo in m2.Get())
{
foreach (PropertyData pdc in mo.Properties)
{
Console.WriteLine(pdc.Name + " = " + pdc.Value);
}
}
|
|
|
|
|
Thanks for the help... Its worked for me
|
|
|
|
|
Anywho, If i add a node
this.treeview1.Nodes.Add("ParentNode");
How do i add a node to it?
I can do this
this.treeview1.SelectedNode.Nodes.Add("ChildNode");
but it means having to click on the node first, which i cant do.
|
|
|
|
|
Don't use Nodes.Add(string) use Nodes.Add(TreeNode)
led mike
|
|
|
|
|
Actually, i am adding a node, i just used text to help the example. So err, still kinda stuck here.
|
|
|
|
|
Is there any way i can do this:
TreeNode folder = treeView1.SelectedNode.Nodes.Add(oNode);
folder.Nodes.Add(TreeNode);
It comes up with 'can't implicitly convert int into TreeNode'
It doesnt have this problem if i'm adding text as a node, only when i add an object as a node.
|
|
|
|
|
|
oNode is a TreeNode, so all is good, i can add it to the treeview, but i want to give it children <-- that sounds wierd
|
|
|
|
|
The Undefeated wrote: but i want to give it children
how about TreeNode.Nodes so if oNode is a TreeNode then:
oNode.Nodes.Add( anotherNode);
led mike
|
|
|
|
|
Hi,
I have to build a layer of serviced components over a DAL (data access layer). Now this DAL was written using interop in VC++.
I built my component using a snk - which worked fine till i added the code to access DAL. Now it gives me an error sayin that assemly cannot be created as DAL does not have a strong name.
How do I get rid of this problem? How can i reuse the existing component without having to rewrite it in .net environment?
I recently read an article sayin that i would have to generate a strong key for the interop dll using tlbimp... but i somehow am not able to figure the parameters out ... has anybody done this?
Any help will be appreciated!
|
|
|
|
|
Hi,
I'm developing a remote application, which means a windows application that controls an existing windows application by using the Win32 API (SendMessage, FindWindow, etc.). Problem is the following: The other application, which already runs and has to be controlled, has a button, that opens an OpenFileDialog, when being clicked. My remote application does so by sending the appropriate message to the other form. The OpenFileDialog is shown, but my remote application stops processing its code, it doesn't continue working (easy to see in debugger: code is executed till button click command is sent, then everything stops. If I manually cancel the OpenFileDialog, rest of the code is executed)! This is a situation that I want to avoid, I want the application to work on. Any ideas how to circumvent that?
Greetings
working in visual c# express 2005
developing usual windows application
|
|
|
|
|
Found the problem: I used SendMessage instead of SendNotifyMessage.
|
|
|
|