Page 1 of 1

Using Settings?

Posted: Wed Jun 01, 2011 10:00 pm
by zachman61
I know in vb you use
my.settings.
who would you do this in c# for a if then
like
in vb it would be
Code: Select all
If my.settings.blah = "" then
Form1.show
i know i left out the end if
but how do i show a form also for that matter lol.

Re: Using Settings?

Posted: Wed Jun 01, 2011 10:09 pm
by Axel
Code: Select all
if(Properties.Settings.Default.Blah == null)
{
Form1 frm = new Form1();
frm.Show();
}
Or if you want blah to be a specific text , just replace null with text between quotation marks

:D

Re: Using Settings?

Posted: Wed Jun 01, 2011 10:25 pm
by zachman61
Thanks Axel :)

Re: Using Settings?

Posted: Wed Jun 01, 2011 10:52 pm
by Agust1337
or you can do
Code: Select all
using 'projectname'.Properties;
public class 'projectname'
{
private void button1_Click(object sender, eventargs e)
{
if (settings.default.something == null)
{
Form1 frm = new Form1();
frm.Show();
}
}
}