Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Cannot get code to build
Re: Cannot get code to build [message #16446 is a reply to message #16445] |
Mon, 16 June 2008 08:18   |
|
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:
void Experiment::btnCalcClick()
{
String UnitsChoice;
UnitsChoice = UnitsDropBox.GetValue();
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:
UnitsChoice.Add(4, "Bits").Add(6, "Bytes")
void Experiment::btnCalcClick()
{
numBitsOutput = ~UnitsChoice;
}
|
|
|
Goto Forum:
Current Time: Sun Apr 27 22:26:41 CEST 2025
Total time taken to generate the page: 0.01052 seconds
|