473,385 Members | 1,400 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,385 software developers and data experts.

i need help in C# cant solve String to Bool problem

Expand|Select|Wrap|Line Numbers
  1. If ComboBox1.Text = "Manual" Then
  2.             Form2.Show()
  3.         End If
  4.         If ComboBox1.Text = "Non-Manual" Then
  5.             Form3.Show()
  6.         End If
  7.         If ComboBox1.Text = "Member" Then
  8.             Form4.Show()
  9.         End If
i need to convert this VB.net Codes to C#.. -.-

i tried using this :

Expand|Select|Wrap|Line Numbers
  1.       Form2 form2 = new Form2();
  2.             if (ComboBox1.Text = "Manual");
  3.  
  4.             form2.Show();
blue underline at (ComboBox1.Text = "Manual");

here is the error:

Error 2 Cannot implicitly convert type 'string' to 'bool'


i really need some help :D
Aug 18 '10 #1
2 1116
GaryTexmo
1,501 Expert 1GB
The comparison operator for equality in C# is a double equal sign. So what you're actually doing is an assignment statement :) It's one of those language quirks from C.

Expand|Select|Wrap|Line Numbers
  1. if (ComboBox1.Text == "Manual") { ... }
Aug 18 '10 #2
thanks it helped :D
Aug 18 '10 #3

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

Similar topics

3
by: Gomaw Beoyr | last post by:
If I have an object o and want to check if it's a certain interface, I write like this: bool oIsIMyInterface = o is IMyInterface; However, if I have a Type object t, and I want to check if...
2
by: gh | last post by:
Hi every Body .. in C# if I wont the user to Input a Number I write the code: // ... the 1st way for int String Number; int X; Console.Write("Enter A Number:");
5
by: gmccallum | last post by:
I am trying to convert the value of a string to a defined enum value such as follows. public enum MyEnum { One, Two }; string MyString = "One"; // or even this is fine string MyString2 =...
5
by: Mike Labosh | last post by:
In T-SQL, Consider this table: CREATE TABLE stringTest ( String1 VARCHAR(5), String2 VARCHAR(5) ) GO INSERT StringTest VALUES ('', 'A') INSERT StringTest VALUES ('A', '') GO
4
by: Gaijinco | last post by:
I made this function which given two strings c1 and c2 test if with the letters of both you can exactly form the string c3, so for exaple c1 = "evol" c2= "ution" and c3 = "evolution" will yield...
2
by: Wallace | last post by:
Hai All, I am having a doubt in string.split, here the code sample string str = "school college job"; note that there is '\t' spacing between each term in the string str. how...
11
by: Prof.Stanley | last post by:
hello , i ma new in this group and writing over the fact that i have a small project at hand,i am writing a program which can permit the input of a text of arbitary lenght,and the number of double...
5
by: Martin Jørgensen | last post by:
Hi, The piece of code I'm struggling with is so simple, that I hope nobody wants a complete example for answering the question: -------- string color_line; int data_type = 0; for(...
7
by: ad | last post by:
I want to determinate if there are alphabets in a string. (not all number) How can I do?
5
by: tech | last post by:
Hi, I need to parse a string used to represent a time and then populate a simple time struct. The time string will always be this format 23:45.45 ie hours separated from mins by ':' and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.