|
Good work; you're definitely off to a better start.
One little detail is in how you define the Client class:
public class Client:ClientList
{
public int id;
public string ClientNm;
}
The Client class should not inherit from ClientList . Inheritance supports the "is-a" relationship, but ClientList ->Client is a "has-a" relationship (more, see "Inheritance"[^]). The way it's set up now, each individual Client also has its own array of Client s.
If you simply remove the :ClientList from that definition, it should behave just fine.
Also, if the array of Client objects defined in ClientList were called "Clients", it would follow common convention and have a more natural reading flow, since arrays imply an intent to hold more than just one object.
--
I've killed again, haven't I?
|
|
|
|
|
|
Thank you, you're right...that's an excellent article...
-Kay
|
|
|
|
|
The value assigned to the text box is 0 because it is 0. You must initialize you variable first. And I agree to alex, you really have to read some books. Such silly questions simply flood the forum.
I wish you luck,
Pavel
|
|
|
|
|
The variable is initialized and populated correctly. The value is 0 because the value is not carrying over through my application. Declaring it as static fixed this as my initilizing and value assigning was not only valid to the local procedure. Maybe I'm not the one who needs to read books here because I challenge you to make it work without using static.
P.S.--Don't waste your whole day on it... it's not that big a deal... I'm just trying to prove a point.
-Kay
|
|
|
|
|
And you call this a challenge. There's nothing more simple than that. You have to do 4 things:
1. Remove the keyword static
2. Declare an instance of your class in the global scope of the class where you want to use it
3. Initialize the instance
4. Use it
Really simple, isn't it
P.S.:
Take it easy, pal. Every programmer has been a beginner
|
|
|
|
|
hi key,
your code shows you didnt create instance of Patient class,only reference you declared which do not reserve any memory on jeap.simply solution is that
first create instance of Patient class theh use medhods. like this
private void Form1_Load(object sender, System.EventArgs e)
{
Patient PatientData = new Patient();
PatientData.id[0] = 0;
PatientData.Lname[0] = "Smith";
PatientData.Fname[0] = "John";
PatientData.Mname[0] = "Allen";
}
public class Patient
{
public int[] id = new int[5];
public string[] Lname = new string[5];
public string[] Fname = new string[5];
public string[] Mname = new string[5];
}
it will work fine.
nikesh
nikesh
|
|
|
|
|
Is there a way to create a loopback adapter using C#?
|
|
|
|
|
picasso2 wrote: Is there a way to create a loopback adapter using C#?
Yes there is.
What is a loopback adapter?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hehe, didnt quite have the same effect as the sudoko one
|
|
|
|
|
|
What do you mean by loopback adapter? Loopback would exist in the network stack, not in an applications space.
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
Sometimes it is easy to test some applicatins using Microsoft loopback adapter. It does not need a real network. I wanted to have this usility for that purpose specially if the end user is not computer-oriented or the application needs to be run on a laptop (no connection)
|
|
|
|
|
I understand why you want to use the loopback adapter, I just don't understand what you mean by creating one with C#
Matt Newman
Even the very best tools in the hands of an idiot will produce something of little or no value. - Chris Meech on Idiots
|
|
|
|
|
guys, i dont know how to sort the data(item)inside the text file alphabetically line by line? - i read my book and read help but no information regarding that matter..
can you give me the codes for that so i'm able to easily understand.
Hope ur help and response...
tnx a lot..
regards,
JayR
|
|
|
|
|
private void MenuItem_SampleSortFile_Click(object sender, System.EventArgs e)
{
ArrayList list = new ArrayList();
list.Add("I don't know how to sort the data");
list.Add("inside the text file line by line");
list.Add("I read my book and read help");
list.Add("but no information regarding that matter");
list.Add("can you give me the codes");
list.Add("so I am able to easily understand");
list.Add("Hope your help and response");
list.Sort();
System.IO.StreamWriter writer = new System.IO.StreamWriter("c:\\test.txt");
foreach( string sline in list)
writer.WriteLine( sline);
writer.Flush();
writer.Close();
}
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi led mike...
It works! It helps a lot..
Thank you so much...
regards,
JayR
|
|
|
|
|
Hi there,
I'm not writing spyware, promise! I actually want to write a program that will notice whenever the user's query is filtered (by the firewall content filtering), and send an email to the IT department asking them to unblock it politely. Everyone hates the filter, and this seems like an effective protest . Anyway, that's not what matters.
My program requires the ability to monitor the user's browser---preferably Firefox and IE, but most school computers use IE, so that would be fine. I would imagine there's a way to hook into the window object, and find the sub-"window" that represents the location bar and get its text. Yes? I think I've seen this kind of thing done in C++, but I much prefer C# if possible... I just have no idea where to start. Googling was unhelpful; I can't seem to come up with good keywords.
Thanks!
-Domenic Denicola- [CPUA 0x1337]
|
|
|
|
|
Do you really think that spamming the IT department will change the filtering policy? Don't you think that it rather will affect the ability to send mail from programs, or the ability to install programs on the computers?
---
b { font-weight: normal; }
|
|
|
|
|
Hello.
I need to reomve all events from an event:
let's say i have a Button event:
this.button1.Click += new System.EventHandler(this.button1_Click);
Than the Button moved to another class and i need to remove all events From the "Click" event.
I tried
button1.Click = null; // Remove All events (Microsoft MSDN...)
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp04192001.asp[^])
error :
The event 'System.Windows.Forms.Control.Click' can only appear on the left hand side of += or -=
I can't use: button1.Click -= this.button1_Click;
The new class does not have the "button1_Click" reference.
Im using VS 2005.
|
|
|
|
|
foreach (Delegate del in button1.Click.GetInvocationList()) {
button1.Click-=new EventHandler(del);
}
This should work; just haven't tested it yet!
Graham
|
|
|
|
|
It does not work.
i still get the same error.
|
|
|
|
|
why do u need to do like this
button1.Click = null; // Remove All events (Microsoft MSDN...)
Instead simply delete all the lines which add the click events to the button
|
|
|
|
|
Hi
I need some help in how to add an application that do encryption of AES or DES or RSA doesn't matter becuase I have the code , but I don't know how to link this code to outlook so when the sender whant to send the email and he click on encrypt check box the email will be encrypted when it is send to the receiever .... so when the email travle from network A to network B it will be encrypted.
Thanks
|
|
|
|
|
Hello. Is it possible in C# to retrieve the Device Instance Id of all connected USB devices? I've tried USBSharpLib but it doesn't do what I need.
My ultimate goal is to detect a specific USB Camera and save files on the SD card inside. I've tried listing the logical drives, WIA, TWAIN and some (not all) of the WMI code snippets found on MSDN. The reason is, I need to make sure that data is being sent to the SD card. The camera does not show up as a logical drive. When I plug it in and go to "My Computer" it shows up at bottom with just the name of the camera. It also shows up under the Device Manager --> Imaging devices and I can get the Device Instance Id from there.
I need a way to do the above programmatically. I must also mention that I can't drag and drop files onto the camera when I double-click it under "My Computer". Any help or further resources or source code would be greatly appreciated. I have been trying for weeks to accomplish this.
Mike
|
|
|
|