3xodus
Freshman
Hi,
I'm writing a user interface for an online gaming system (found at TeamXLink.co.uk - it allows you to play XBox, PlayStation 2, Gamecube, PSP and Nontendo DS games online). The XLink engine, which does all the work tunneling packets over the Internet) is seperate from the UI, so basically you can write a UI in any language you like, so long as you communicate between the UI and engine correctly.
Anyway, onto my problem - I have a treeview populated with a list of online users (tvChatUsers) and a tabControl (tabPrivateMessages). I want to add a new tab to the tabControl when a user is double clicked on, the tab should contain a button, richTextBox and a textBox. I have the following code to add a tab:
(e.Node.Text contains the users name)
That works fine, and adds a tabPage to the tabControl with the users name as it's .Text property.
The part I'm having a problem with is adding a button and textBox to the tabPage container.
I tried:
But got the error "Use the new keyword to add an object instance." on the second to last line. I don't see how to use the new keyword here - I thought my first two lines were creating the object instances?
Also is it possible to name the button and textBox? - I was hoping to include the value at e.Node.Text in the name so that I know which button is being clicked - which user to send the message to.
Thankyou for any suggestions ro links
I'm writing a user interface for an online gaming system (found at TeamXLink.co.uk - it allows you to play XBox, PlayStation 2, Gamecube, PSP and Nontendo DS games online). The XLink engine, which does all the work tunneling packets over the Internet) is seperate from the UI, so basically you can write a UI in any language you like, so long as you communicate between the UI and engine correctly.
Anyway, onto my problem - I have a treeview populated with a list of online users (tvChatUsers) and a tabControl (tabPrivateMessages). I want to add a new tab to the tabControl when a user is double clicked on, the tab should contain a button, richTextBox and a textBox. I have the following code to add a tab:
Code:
TabPage PMtab = new TabPage(e.Node.Text.ToString());
tabChat.TabPages.Add(PMtab);
That works fine, and adds a tabPage to the tabControl with the users name as it's .Text property.
The part I'm having a problem with is adding a button and textBox to the tabPage container.
I tried:
Code:
TabPage PMtab = new TabPage(e.Node.Text.ToString());
Button PMbutton = new Button();
PMbutton.Text = "Send";
PMtab.Container.Add(PMbutton);
tabChat.TabPages.Add(PMtab);
Also is it possible to name the button and textBox? - I was hoping to include the value at e.Node.Text in the name so that I know which button is being clicked - which user to send the message to.
Thankyou for any suggestions ro links