Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Cannot get code to build
Cannot get code to build [message #16445] Mon, 16 June 2008 08:04 Go to next message
R-Thor is currently offline  R-Thor
Messages: 2
Registered: June 2008
Junior Member
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 Smile
Re: Cannot get code to build [message #16446 is a reply to message #16445] Mon, 16 June 2008 08:18 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
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:

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 Smile


Try == operator instead of = Wink. But even then you could change your code a bit:
UnitsChoice.Add(4, "Bits").Add(6, "Bytes")
void Experiment::btnCalcClick()
{
	numBitsOutput = ~UnitsChoice;
}

Re: Cannot get code to build [message #16447 is a reply to message #16446] Mon, 16 June 2008 08:28 Go to previous message
R-Thor is currently offline  R-Thor
Messages: 2
Registered: June 2008
Junior Member
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

[Updated on: Mon, 16 June 2008 08:44]

Report message to a moderator

Previous Topic: Ide console
Next Topic: RemoveChild(GLCtrl) --> 100% CPU
Goto Forum:
  


Current Time: Thu Apr 18 23:39:46 CEST 2024

Total time taken to generate the page: 0.01565 seconds