View previous topic :: View next topic |
Author |
Message |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Aug 22, 2007 9:08 am Post subject: [Help: C++] Last Questions |
|
|
these are my last questions for now. then i wont ask questions for a while
i wanna make sur e that a textBox has:
1. Only Numbers
2. It is not Empty (ive tried some stuff like textBox1->Text->IsNullOrEmpty, but i dont know how to use it properly)
Example Code would be nice, thanks _________________
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Wed Aug 22, 2007 10:20 am Post subject: |
|
|
I can tell you in Delphi.
If Edit1.Text = '' then //if the box is empty then
{Your code here} //your request here
What are you trying to do ? |
|
Back to top |
|
 |
merkark12 Advanced Cheater
Reputation: 0
Joined: 04 Jul 2007 Posts: 74 Location: In that program you just downloaded
|
Posted: Wed Aug 22, 2007 10:22 am Post subject: |
|
|
do you mean .net? _________________
|
|
Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Wed Aug 22, 2007 10:27 am Post subject: |
|
|
In C++ you can put an atoi() in a try-catch structure, or loop all the chars and check if they are numbers. |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Aug 22, 2007 4:16 pm Post subject: |
|
|
um.. any simpler? cuz i dont wanna make a huge code.... im sure there r functions...
textBox1->Text->IsNullOrEmpty
textBox1->Text->Length
those 2 seem ez, just is there a special way to use them? _________________
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Aug 22, 2007 6:17 pm Post subject: Re: [Help: C++] Last Questions |
|
|
lurc wrote: | these are my last questions for now. then i wont ask questions for a while
i wanna make sur e that a textBox has:
1. Only Numbers
2. It is not Empty (ive tried some stuff like textBox1->Text->IsNullOrEmpty, but i dont know how to use it properly)
Example Code would be nice, thanks |
Use a MaskedTextBox control. You can set it to only accept numeric. |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Aug 22, 2007 8:11 pm Post subject: |
|
|
that solves 1 thing. but i still have to make it check if its empty
also i dont like how the RichEditBox works.. it masks a bunch of 0's with spaces but u can click anywhere in between unlike a normal text box , it just starts at the beggining _________________
|
|
Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Thu Aug 23, 2007 7:29 am Post subject: |
|
|
Code: | char buffer[256];
if (!GetWindowText(hTextBox, buffer, 256)) MessageBox(0, "phail", "empty", 0); |
_________________
Don't laugh, I'm still learning photoshop! |
|
Back to top |
|
 |
Icos Grandmaster Cheater
Reputation: 0
Joined: 12 May 2007 Posts: 524
|
Posted: Thu Aug 23, 2007 8:44 am Post subject: |
|
|
Are you talking about Win32 C++? You can add ES_NUMBER attribute while using CreateWindow to force it to accept numbers only. |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Aug 23, 2007 9:23 am Post subject: |
|
|
Managed C++
Edit:
Nvm, i figured it out.
i was putingg this line at the bottom as "else if" instead of putting it at the top as "if"
Code: | textBox1->Text->IsNullOrEmpty(textBox1->Text) |
_________________
|
|
Back to top |
|
 |
|