Start New Discussion within our Software Development Community

This may seems noobish but 3 questions I absolutely cannot figure out.

I'm not sure how relevant it is but I'm using Microsoft Visual C# 2010 Express.

1) How do I have a button, within a form, load another form within the same program.

2) How do you do the above, however have it load up within a tabbed program (Visual Studio had this option but I can't figure out how to utilize it).

3) How do you take a text field and translate that into a variable.
e.g. textBox1 contains "hello", how can I place this current value into var string.

Thank you in advance for any input.

It sounds like you need to spend a little time studying some introductory material, such as this section on MSDN:

Creating Windows Forms

In brief; a form is a definition of a class, you create an instance variable of that class type in your program, then you can display that form instance as either a modal or non-modal form. e.g.
Form2 myForm = new Form2();
then, myForm.Show() will load a non-modal form, while myForm.ShowDialog() will create a modal form which must be closed before you can set focus back to the form which created it. Refer to the link above for some user-friendly examples.

As for tabbed forms, I'm not sure what your required layout is, but the commonest approach is called MDI Forms, where you have a master or parent form and load one or more child forms within the parent. Various tricks can be used to provide navigation between the child forms, such as tab-bars and tree-views etc. This may be a useful guide:

How to create MDI Child Forms

And finally, text from a textbox... A textbox control is an object, which has a number of attributes, the Text attribute references the current text value, so for instance you could use:

textBox1.Text = "asdf";
or
string theText = textBox1.Text;

This article has been dead for over six months. Start a new discussion instead.