By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,891 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,891 IT Pros & Developers. It's quick & easy.

2 Problems with Visual C#

P: n/a
The first one is: Cannot implicitly convert type 'int' to 'bool'
The second one: 'System.Windows.Forms.FormWindowState' is a 'type'

The code is:

private void button6_Click(object sender, EventArgs
e)
{
int i;
if (i = 2)
{
i = 0;
}
else
{
i += 1;
}
if (i = 1)
{
FormBorderStyle = FormBorderStyle.None;
FormWindowState = FormWindowState.Maximized;
button6.Text = "Normal Screen";
}
else
{
FormBorderStyle = FormBorderStyle.Sizable;
FormWindowState = FormWindowState.Maximized;
button6.Text = "Full Screen";
}
}
Oh, how can i use the "static" thing in C#?
Sorry, i worked long time with Visual Basic and it's hard for me to
move to another language.

Michaelas10
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
It's "if (i == 2)" (with two =) instead of "if (i = 2)".

S. L.

"Michaelas10" <Mi*********@gmail-dot-com.no-spam.invalid> wrote in message
news:42********@127.0.0.1...
The first one is: Cannot implicitly convert type 'int' to 'bool'
The second one: 'System.Windows.Forms.FormWindowState' is a 'type'

The code is:

private void button6_Click(object sender, EventArgs
e)
{
int i;
if (i = 2)
{
i = 0;
}
else
{
i += 1;
}
if (i = 1)
{
FormBorderStyle = FormBorderStyle.None;
FormWindowState = FormWindowState.Maximized;
button6.Text = "Normal Screen";
}
else
{
FormBorderStyle = FormBorderStyle.Sizable;
FormWindowState = FormWindowState.Maximized;
button6.Text = "Full Screen";
}
}
Oh, how can i use the "static" thing in C#?
Sorry, i worked long time with Visual Basic and it's hard for me to
move to another language.

Michaelas10
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #2

P: n/a
And for your second problem, you have to replace

FormWindowState = FormWindowState.Maximized

by

this.WindowState = FormWindowState.Maximized (or WindowState =
FormWindowState.Maximized)
Nov 16 '05 #3

P: n/a
Thanx alot, they both fixed.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #4

P: n/a
the code: panel3.Dock = DockStyle.Right(); - gives me the
error:

'System.Windows.Forms.DockStyle.Right' is a 'field' but is used like a
'method'.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #5

P: n/a
the code: panel3.Dock = DockStyle.Right(); - gives me the
error:

'System.Windows.Forms.DockStyle.Right' is a 'field' but is used like a
'method'.

Remove the parentheses.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #6

P: n/a
> Mattias Sjögrenwrote:
[quote:e324bdccd8]the code: panel3.Dock = DockStyle.Right(); -
gives me the
error:

'System.Windows.Forms.DockStyle.Right' is a 'field' but is used like a 'method'.


Remove the parentheses.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.[/quote:e324bdccd8]

Sorry but what is parentheses?

Michaelas10
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #7

P: n/a
The brackets after DockStyle.Right

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Mattias Sj&ouml;grenwrote: [quote:e324bdccd8]the code: panel3.Dock = DockStyle.Right(); -
gives me the error:

'System.Windows.Forms.DockStyle.Right' is a 'field' but is used like a 'method'.


Remove the parentheses.

Mattias

--
Mattias Sj&ouml;gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.[/quote:e324bdccd8]

Sorry but what is parentheses?

Michaelas10
Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.