473,395 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Visual C++ Forms problem w/conversion?

I am having trouble w/conversion - I have a text box that has a value of type Char that I am looking at to determine which value to pull from an array. If it is F or f it would pull from an array called whole, if it is H or h it will pull from an array called half. I keep getting told that:
1>c:\users\sophia\documents\visual studio 2010\projects\final\final\Form1.h(206): error C2440: '=' : cannot convert from 'System::Double ^' to 'System::Windows::Forms::TextBox ^'
No user-defined-conversion operator available, or
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

I was told to use wchar_t to convert it and it worked in one spot of the code but it is not working in this part - can someone tell me what I am doing wrong?

Expand|Select|Wrap|Line Numbers
  1.  {
  2.  wchar_t convertDuration;
  3.  convertDuration = System::Convert::ToChar(txtDuration->Text);
  4.  
  5. if(txtDuration->Text=="F" || txtDuration->Text=="f")
  6.      txtCharge=whole[lstEquipment->SelectedIndex];
  7.  
  8. else if(txtDuration->Text=="H" || txtDuration->Text=="h")
  9.      txtCharge=half[lstEquipment->SelectedIndex];
  10.  
  11. else
  12.      MessageBox::Show("Incorrect letter entered");
  13.  
  14.  
  15.          }
  16.  
here is the code from the txtCharge
Expand|Select|Wrap|Line Numbers
  1. // txtCharge
  2. // 
  3. this->txtCharge->Location = System::Drawing::Point(176, 176);
  4. this->txtCharge->Name = L"txtCharge";
  5. this->txtCharge->Size = System::Drawing::Size(86, 20);
  6. this->txtCharge->TabIndex = 5;
  7. // 
  8.  
  9.  
and here is the code from the txtDuration
Expand|Select|Wrap|Line Numbers
  1. // txtDuration
  2. // 
  3. this->txtDuration->Location = System::Drawing::Point(228, 150);
  4.  
  5. this->txtDuration->Name = L"txtDuration";
  6. this->txtDuration->Size = System::Drawing::Size(34, 20);
  7. this->txtDuration->TabIndex = 3;
  8. this->txtDuration->TextChanged += gcnew System::EventHandler(this, &Form1::Input_Duration);
  9. // 
  10.  
This is the code for the arrays:
Expand|Select|Wrap|Line Numbers
  1.  
  2. public ref class Form1 : public System::Windows::Forms::Form
  3. {
  4. private:static array <double^>^ half = gcnew[] = {16.0,12.0,20.0};
  5.  
  6. private:static array <double^>^ whole = gcnew[] = {24.0,18.0,30.0};
  7.  
  8. private:static array <String^>^ *equipment = gcnew[] = {"1- Rug Cleaner","2- Lawn Mower","3- Paint Sprayer"};
  9.  
  10.  
I have attached the whole form.h file in case it can help. I have already had to turn this in - so I am just looking to see where I went wrong... so your advice is valuable - but not helping me finish the program for the assignment.
Attached Files
File Type: doc code.doc (43.5 KB, 213 views)
Dec 15 '11 #1
0 1249

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: olle | last post by:
Hi everyone. I am an Access developer having worked with Access-dev. projects for many years on Sql server databases and Access. For the internet I have been using traditional asp. But now I have...
3
by: Mike Kitchen | last post by:
I am writing an application in visual basic from a C# that I have already written. I am trying to convert the following line of code into VB, but I do not completely understand the help pages....
5
by: Tom | last post by:
We currently have a rather large application that is in VB.NET 2002. We have just purchased licenses to the 2003/1.1 Framework version of Visual Studio. What kind of conversion, if any, will we...
7
by: Victor S. | last post by:
1. What is System.Windows.Forms.VisualStyles.TextMetricsCharacterSet good for? 2. Are the Indic scripts supported? Are all supported scripts fully supported? (for printing and fine measuring)...
10
by: Arno R | last post by:
Hi all, I have a database that I need to use in different versions of Access. This is A97 in most places and A2k in a few other locations. (I develop in A97 and convert the db to A2k for these...
54
by: m.roello | last post by:
In the book: "Working with Microsoft Visual Studio 2005" Craig Skibo wrote: "The power of Visual Studio 2005 lies in its ability to empower users to build, test, and debug powerful applications...
0
by: Massimiliano Polito | last post by:
It seems the option '/useenv' is no longer supported in in Microsoft Visual .NET 2005. If I run 'devenv /?' I get the following: ------------------------ Microsoft (R) Visual Studio Version...
0
by: Marchand | last post by:
Hi, after the Visual Studio 2005 vb6 to vb.Net conversion wizard end execution, the projet does not load properly in the solution. The error is file not found. But when I look in the...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.