|
Please use the search capabilities of Code Project and also try Google. No one here is going to do your searches for you. This is why your posts are being ignored.
Regards,
Eric C. Tomlinson
I won't dignify your question with an answer. Yes, I program in VB6, but only because I'm addicted to eating!
|
|
|
|
|
I have hit a stumbling block......in my code I create a number of tab pages on a tab control. This can differ from person to person.
On each tabpage I have the following:
- Panel1 (name tab?_panel1) which contains:
-- treeview (tab?_treeview)
-- listbox (tab?_listbox)
- Panel2 (name tab?_panel2) which contains:
-- listview (tab?_listview)
-- richtextbox (tab?_richtext)
The "?" obviously refers to the tabpage that owns the control (tab0, tab1 etc.).
Where I've gotten stuck is this....how do I refer back to these controls elsewhere in my code? Specifically....I'm using a common event handler, getting the name of the parent (tabpage) of the parent (panel) from object sender. So I *know* the treeview on tab0 sent the event....how do I do "something" with the listview that is on tab0 (tab0_listview) based on the event tossed by tab0_treeview?
Thanks.....
|
|
|
|
|
What I usually do in this type of situation is to give the controls a name that I can rebuild later (much like you do) and create a lookup routine to find them. Doesn't make much sense without an example, huh.
I would name the controls (as I create them) with a name that can be easily parsed from within any event handlers invoked by the control. In keeping with your example,
Panel1 would be named 'tab_1_panel' and would contain
-- tab_1_treeview
-- tab_1_listbox
Panel2 would be named 'tab_2_panel' and would contain
-- tab_2_treeview
-- tab_2_listbox
In this way when an event is fired, I can parse the '1' or '2' out of the name of the invoking control, build the name of the control I need to access and look it up withing the parent's 'control' collection. If the tab_1_treeview fired an event and I needed access to the tab_1_listbox control, I would do the following from the event handler:
Step1 - ParseName
-- string[] sValues = oSender.Name.Split('_'); // returns an array with 3 elements 'tab', '1' and 'treeview'
-- int nIndex = sValues[1];
Step2 - Build listbox name
-- string sName = "tab_" + nIndex.ToString() + "_listbox";
Step3 - Retrieve control from the parent's controls collection
-- ListBox oListbox = this.Parent.Controls[sName];
Let me know if this works for you
|
|
|
|
|
Lets say i have a program, and i want ot be able to minimize it to the tray, so when the user right clicks on it, it brings up a menu. How would i do this?
//Otis
|
|
|
|
|
Check out the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsnotifyiconclasstopic.asp">NotifyIcon</a>[<a target=_blank title='New Window' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsnotifyiconclasstopic.asp">^</a>] class.
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thankyou for uhh... notify'ing me of that :P
//Otis
|
|
|
|
|
Otis_69 wrote:
Thankyou for uhh... notify'ing me of that
Hope it helps...
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hey, me again, just wondering iff anyone knows how to get rid of the console window... Im making my forms dynamically, using a console application, but if the console window shows, it isnt as attractive...
//Otis
|
|
|
|
|
I think you get what you want, if you create a Windows application and fill the Main-method with some other code before showing a form.
<br />
static void Main() <br />
{<br />
System.Windows.Forms.Application.Run(new MainForm());<br />
}<br />
www.troschuetz.de
|
|
|
|
|
I know, but i made a console program, its an irc server, and now i want to make it use a tray icon, so you can tell tyhe status of the server, but i already coded 75% of it in console, and i cba to switch to a windows application... Isnt there a compiler directive to hide the console?
//Otis
|
|
|
|
|
Don't know a direct way to do this, cause I never coded a console application with .NET. Maybe you could use some API methods to hide the console window.
Is it so complicated to copy the "console" code to a Windows Application to reach the effect you want.?
www.troschuetz.de
|
|
|
|
|
yes. One, is file size, and i dont want the program to be loading all the stuff i dont need. File size saves time (downloading and running) and saving time means more users (most likley me and a bunch of friends) will want it to be fast, small, etc.
Would it be possible to grab the process and set it to hid somehow through that?
//Otis
|
|
|
|
|
OMG, this is my second time writing this, cause last time i wasnt logged in, and i clicked submit, and it said i needed to login, so i hit back to copy/paste my post into notepad, and it was gone... arrgh. Anyways:
I have a class, lets call it "IrcBot". Now, i instanciate it like this:
IrcBot mybot = new IrcBot("server","channel","nick");
now, in my main class, i make a thread (or 10) all going to the same, or different irc servers... like this:
Thread t = new Thread(new ThreadStart(mybot.connect));<br />
t.Start();
seeing as there is no way to terminate the connection from the bot to the irc server, i cant terminate the thread, cause the thread is still doing something... In english, when i do t.Abort(); it doesnt stop and the bot is still in the irc server in that channel... How can i force the thread to stop regardless of whether its doing something or not?
Thanks for the help :P
//Otis
|
|
|
|
|
What i did now, is i made an instance of a timer within my thread, and set the interval to 1 millisecond...
System.timers.timer t = new System.timers.timer(1);
Then i made the event handler thing
t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed);
and the elapsed method looks like this:
private void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)<br />
{<br />
if(System.Threading.Thread.CurrentThread.ThreadState.Equals(System.Threading.ThreadState.AbortRequested))<br />
{<br />
connection.Disconnect("Gotta go!");<br />
} <br />
}
Why wont that terminate the connection & die when i call abort from the main thread?
//Otis
|
|
|
|
|
Well, i finally figured it out...
In the IrcBot class, i made the variable holding the connection public. Then, before i started the thread, i grabbed that connection, and stored it in a variable. Then when i want to abort the thread, i use the variable and disconnect, and then abort It is kinda crude, but it works
//Otis
|
|
|
|
|
What would you suggest as the easiest way of converting a stream to a string?
|
|
|
|
|
|
System.Web.UI.WebControls.Label myLabel = new System.Web.UI.WebControls.Label();
myLabel.Text = "Enter Client ID";
this.Controls.Add(myLabel);
This is not working .. any help..please
|
|
|
|
|
What do you mean by "doesn't work" (what kind of exception are you getting?). I believe you need to set other properties of the newly created label, such as location and size. I usually set the following and never have a problem:
Name
Location
Size
BackColor
ForeColor
Hope this helps
|
|
|
|
|
Hi Guys,
I want to port my old client-server programme from VB6 to C#, and I want to use some new stuff from the .NET Framework. Especially how the two programmes communicate with eachother.
Verbodrome (that is how the programme is called) is used in classrooms, for example 20 students are working on it, and the teacher can centrally view the state of each student. In VB6 this was done with a TCP/IP connection but since the server took a lot of processing load (serving 20 clients) it just wasn't scalable.
So what I want to do is this:
- An object 'session', wich stores the various questions. It is cloned for every client so the 'session' object also stores the answers the students gave.
It is hosted on the server with following advantages. 1) When the students quit their session, the information is still stored on the server, and next time they log on they can work further on their previous session, and the teacher can view the progress the student is making. 2) Every time the student gives a new answer, the statistics on the server screen are real-time updated (thats where the events come in).
There are various other objects in the project, but all with similair purposes. So i tried to get some basic programme up and running. I constructed a CAO server, wich could fire events to the remote machine (where they were handeled. First problem: CAO servers don't seem to work due to some SOAPSUDS.EXE bug , so i tried a class-factory (a SAO wich generates the necessary 'new session' classes), but when i tried fire my server event, the client gave an error that this wasn't deserialisable... So I adjusted the security settings (1.0 -> 1.1 troubles), but that either was no good.
So now I am asking the outside world, because I really tried everything. I'm a good programmer in VB6 (Verbodrome counts over 58.000 lines) but I am relatively new to C# but I know the basics. If anyone could give me a clue or try to get a class to work that would serve as an example to me, I would greatly appreciate it.
Every goodbye is the birth of a memory
|
|
|
|
|
Hi Guys,
I want to port my old client-server programme from VB6 to C#, and I want to use some new stuff from the .NET Framework. Especially how the two programmes communicate with eachother.
Verbodrome (that is how the programme is called) is used in classrooms, for example 20 students are working on it, and the teacher can centrally view the state of each student. In VB6 this was done with a TCP/IP connection but since the server took a lot of processing load (serving 20 clients) it just wasn't scalable.
So what I want to do is this:
- An object 'session', wich stores the various questions. It is cloned for every client so the 'session' object also stores the answers the students gave.
It is hosted on the server with following advantages. 1) When the students quit their session, the information is still stored on the server, and next time they log on they can work further on their previous session, and the teacher can view the progress the student is making. 2) Every time the student gives a new answer, the statistics on the server screen are real-time updated (thats where the events come in).
There are various other objects in the project, but all with similair purposes. So i tried to get some basic programme up and running. I constructed a CAO server, wich could fire events to the remote machine (where they were handeled. First problem: CAO servers don't seem to work due to some SOAPSUDS.EXE bug , so i tried a class-factory (a SAO wich generates the necessary 'new session' classes), but when i tried fire my server event, the client gave an error that this wasn't deserialisable... So I adjusted the security settings (1.0 -> 1.1 troubles), but that either was no good.
So now I am asking the outside world, because I really tried everything. I'm a good programmer in VB6 (Verbodrome counts over 58.000 lines) but I am relatively new to C# but I know the basics. If anyone could give me a clue or try to get a class to work that would serve as an example to me, I would greatly appreciate it.
Every goodbye is the birth of a memory
|
|
|
|
|
Creating double posts with in the same forum is frowned upon even when using a different login. People will probably just keep ignoring it until you delete the offending posts and re-phrase your question.
Regards,
Eric C. Tomlinson
P.S. Look at some of the articles here on Code Project for threads/threading. Some have the basics for making a threded chat server, which can be modified for communication between clients / server.
I won't dignify your question with an answer. Yes, I program in VB6, but only because I'm addicted to eating!
|
|
|
|
|
I double posted it because
- The first time 'The Code Project' website thought i wasn't logged in
- The (emot)icons didn't work: X|X| looks a bit strange...
And i can't delete the first question because I wasn't logged in so the system doens't know it's ... I can of course delete the second post, but thereby eliminating the reason why I posted it again
|
|
|
|
|
But on both posts your name or intials show up as the user name. How did you do that?
I won't dignify your question with an answer. Yes, I program in VB6, but only because I'm addicted to eating!
|
|
|
|
|
Hi,
Heath had mentioned using a Dataset.Merge for a returned dataset from web service to client but I can't seem to find any property called Merge.
Where do I find it ?
Thanks,
JJ
|
|
|
|
|