|
-
April 18th, 2010, 07:17 PM
#1
Why does not 'int' work? (Type casting)
Hi!
I'm new here, so forgive me if this is in the wrong place...
heres the 'problem' (not really a 'problem', its just something i dont understand even though i got it working)
Basically, I have a field in the database and its a tinyint, i have a simple value there as a '0' or '1' (without the quotes)
(Note: I am using winforms via Visual Studio 2008)
then in the on LOAD code I write:
int for_chkbox=0;
if (this.Settings_ShowSplash_checkBox.Checked)
{ for_chkbox = 1; }
else { for_chkbox = 0; }
but it then throws up this error:
cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?)
i then changed the above code to:
byte for_chkbox=0;
if (this.Settings_ShowSplash_checkBox.Checked)
{ for_chkbox = 1; }
else { for_chkbox = 0; }
and everything works...
Can someone explain to me... why?
Thanks in advance!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|