Click here to Skip to main content
16,013,605 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi all
i am having a string called "myLine"
I want to do an if "myLine" is "Model: iPhone2,1" then show a message box with buttons "am a devoloper" or "No"
please help by giving me the code (know that am greedy) or only redirect me to the right place.
Thanks in Advance
Posted

Make a start at looking for answers in the documentation. The String class is one of the most common ones that you will use so you should read the documentation and at least know the basic methods to answer simple questions like this. I have already given you the link for StringBuilder in one of your other questions, so you should be able to get to String from there.
 
Share this answer
 
Try this:
if Model = iPhone1 or iPhone2 then

elseif myLine = Model then
MessageBox.Show("am a developer",Yes/No)
endif

it might not be perfect but you can try it.
Prasad :-D
 
Share this answer
 
Comments
#realJSOP 2-Jan-11 10:05am    
He wanted unmanaged C++. Your answer isn't C++, managed or otherwise.
Seif Hatem 2-Jan-11 10:59am    
This is a vb.net code
I know this
Seriously? You couldn't come up with this on your own?

string msg = (myLine == "Model: iPhone2,1")?"am developer":"no";
MessageBox.Show(msg);


I'll leave it to you to adjust for your framework of choice (since you didn't specify).



EDIT ===============

This is VERY basic stuff. You could have solved it by now if you weren't so busy seeing if anyone answered your question. How long have you been a programmer?

C++
CString msg = (myLine == "Model: iPhone2,1")?"am developer":"no";
AfxMessageBox(msg);


I haven't done C++ in over 4 years, so if you need more help, you're on your own unless someone else sees fit to try to help you.

 
Share this answer
 
v3
Comments
Seif Hatem 2-Jan-11 8:37am    
am on vC++
Seif Hatem 2-Jan-11 8:39am    
it gives me 6 errors
so please help me am on Visual 2010 C++
Thanks in advance
Manfred Rudolf Bihy 2-Jan-11 9:03am    
I ought to learn reading first. What a way to make myself look stupid! (Somehow can't seem to edit my stupid comments above)
Seif Hatem 2-Jan-11 9:11am    
Sorry I can't understand You
Is there help???
Manfred Rudolf Bihy 2-Jan-11 10:30am    
@Seif: No I posted something stupid and can't seem to remove or edit that now. I'm sorry to have caused confusion.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900