Hello:
I have the floowing code many many times in my code. Is there a way to code it into 1 or 2 lines?
string NYIMessage = "New";
FormNYI FormNYI = new FormNYI(); // Form Not Yet Implemented Dialog
FormNYI.ShowDialog(ref NYIMessage);
Loading
Karan PatelPosted Feb 20, 2010, 11:13 PM
private void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1("world");
f1.ShowDialog();
}
// in child form
public partial class Form1 : Form
{
public string Msg ;
public Form1()
{
InitializeComponent();
}
public Form1(string s)
{
InitializeComponent();
Msg = s;
// now you can use Msg anywhere you required.
button1.Text = Msg;
}
}
Shaik AliPosted Feb 23, 2010, 12:24 PM
public static string NYIMessage="New" in one of the class (Assume declared in MyParentClass) then u can simply access from anywhere as MyParentClass.NYIMessage.
Try it out :)
GustavoPosted Feb 21, 2010, 7:27 AM
Thanks, I used both of you suggestions.
Sam: I used your line in the MDI Parent.
Karan: I used your line in the MDI Child.
I am Super Newbie and you guys/gals on this forum are helping me so much.
Thanks
Sam HobbsPosted Feb 21, 2010, 12:53 AM
Sam HobbsPosted Feb 21, 2010, 12:49 AM