Hello all, new poster so please forgive me if I'm missing anything important. I have a program where I have a Drop List and about ten or so read only fields that I want to output the results of memory conversations (from bits to bytes etc..) into. So I thought I'd make a string and assign it the value of the currently selected item in the Drop List. The Drop List is named UnitsDropBox. I think this snippet of code should suffice to portray the problem, thanks in advance for any help. Oh and the error message when building the code says that it cannot convert from String to bool(??). Well here's the snippet:
if (UnitsChoice = "Bits")
{
numBitsOutput = 4.00;
}
if (UnitsChoice = "Bytes")
{
numBytesOutput = 6.00;
}
}
Oh and if your wondering why the numbers don't make sense, right now I'm playing with test values just to make sure everything works. Once again thanks for any help
unodgs Messages: 1367 Registered: November 2005 Location: Poland
Ultimate Contributor
R-Thor wrote on Mon, 16 June 2008 02:04
Hello all, new poster so please forgive me if I'm missing anything important. I have a program where I have a Drop List and about ten or so read only fields that I want to output the results of memory conversations (from bits to bytes etc..) into. So I thought I'd make a string and assign it the value of the currently selected item in the Drop List. The Drop List is named UnitsDropBox. I think this snippet of code should suffice to portray the problem, thanks in advance for any help. Oh and the error message when building the code says that it cannot convert from String to bool(??). Well here's the snippet:
if (UnitsChoice = "Bits")
{
numBitsOutput = 4.00;
}
if (UnitsChoice = "Bytes")
{
numBytesOutput = 6.00;
}
}
Oh and if your wondering why the numbers don't make sense, right now I'm playing with test values just to make sure everything works. Once again thanks for any help
Try == operator instead of = . But even then you could change your code a bit:
Thanks that fixed the problem. But what is this == exactly? I mean whats it saying in the code thats different than just = Thanks again unodgs immediate help is always appreciated.
Edit: Sorry Googled that last question it was kinda a silly one given that once you gave me the right pointer... But anyways