Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C# (http://www.programmingforums.org/forum16.html)
-   -   Help with GUI in C# (http://www.programmingforums.org/showthread.php?t=12754)

csrocker101 Mar 9th, 2007 2:16 PM

Help with GUI in C#
 
So basically I've made a C# client application that can run in the console. I am trying to add a GUI to it. I have 2 applications, one a console application that holds my logic called ClientApp and a windows form containing the GUI called ClientApp. Rather than post the logic and base could into the windows form class I have tried to rather make them work together (which I am told is the way to go). I have got method that takes the TCP address the person wishes to connect to in my forms class.

public void serverString_TextChanged_1(object sender, EventArgs e)
{
string TCPaddress = serverString.Text;
}

Simply takes the text entered by the user and puts it in a string called TCPaddress. My problem is I am trying to get this information into my actual ClientApp application that connects to the client. I've made a reference to my Client Form called:

ClientForm clientform = new ClientForm();

In my class thats holds the base and logic called ClientApp, the protocol to connect looks like this:

client.Connect("www.amazon.co.uk", 43); The first being the site, second being the port.

but I am trying to feed in what the user has said entered in the textbox from my ClientForm into the clientApp in the area with "amazon.co.uk" by doing something such as:

client.Connect(clientform.serverString_TextChanged_1(TCPaddress)

but it doesnt work!!! :mad: I tried to make a get method that would return TCP address but obviously TCP address is only within the scope of that method. Help!!! Been stuck for 4-5 hours!

crawforddavid2006 Mar 9th, 2007 4:58 PM

first of all use code tags when posting, second could you please post all of your code.

Wizard1988 Mar 9th, 2007 8:14 PM

So when does client.Connect() get called? You might want to put that inside the onClick event handler of your button.

Ooble Mar 10th, 2007 12:08 PM

To get the text entered in a TextBox, just use TextBoxName.Text - it's a lot simpler than you think.


All times are GMT -5. The time now is 2:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC