473,506 Members | 9,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on String and Integer

werks
220 New Member
Hi there programmers.

How can you tell if the input value in a textbox is an Integer or String is there any code to know this?
Jan 31 '08 #1
7 1153
daniel aristidou
491 Contributor
Hi there programmers.

How can you tell if the input value in a textbox is an Integer or String is there any code to know this?
Expand|Select|Wrap|Line Numbers
  1.  If isnumeric(textbox.text) = True then
  2. Msgbox("I am a number")
  3. Else
  4. msgbox("I'M not anumber ,im mostlikely a string")
  5. End if
  6.  
This help?
Jan 31 '08 #2
werks
220 New Member
Expand|Select|Wrap|Line Numbers
  1.  If isnumeric(textbox.text) = True then
  2. Msgbox("I am a number")
  3. Else
  4. msgbox("I'M not anumber ,im mostlikely a string")
  5. End if
  6.  
This help?
Thank you! Thank you! Thank You! very much. You saved my day.


Better Than Yesterday ^^
Jan 31 '08 #3
Killer42
8,435 Recognized Expert Expert
I'd just like to point out that by definition, the value in a textbox is always a string. What you're testing is whether it's possible for VB to convert that string to a number. (Note, IsNumeric() function won't care whether it's an integer - it could be too large for instance).

Oh, and a quick tip, daniel. If you're testing a logical value, there's no point in comparing it to True. It already is True or False. So in this example, the code
If IsNumeric(textbox.Text) = True Then
works exactly the same as
If IsNumeric(textbox.Text) Then.
Except that depending on how smart the compiler is, the shorter version might execute ever so slightyl faster.
Feb 1 '08 #4
shuvo2k6
68 New Member
Hi there programmers.

How can you tell if the input value in a textbox is an Integer or String is there any code to know this?

TextBox's Text Property must be String, if u want to check Integer, there is no fucntion for that for ur need u must take some other way.
Feb 1 '08 #5
Killer42
8,435 Recognized Expert Expert
TextBox's Text Property must be String, if u want to check Integer, there is no fucntion for that for ur need u must take some other way.
daniel aristidou already provided a solution which "werks" :) though it may have problems with large numbers or decimals.
Feb 1 '08 #6
lotus18
866 Contributor
Oh, and a quick tip, daniel. If you're testing a logical value, there's no point in comparing it to True. It already is True or False. So in this example, the code
If IsNumeric(textbox.Text) = True Then
works exactly the same as
If IsNumeric(textbox.Text) Then.
Except that depending on how smart the compiler is, the shorter version might execute ever so slightyl faster.
I didn't know this huh? I learned something new for this day. haha : )

Rey Sean
Feb 1 '08 #7
daniel aristidou
491 Contributor
Hey...killer..you have a valid point... i already knew that...i just always put = True in when trying to explain or if there is more than one statement...so as not to get confused.....
Good point though....
Feb 1 '08 #8

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

Similar topics

3
3325
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
0
1469
by: Shaggyh | last post by:
hi im needing help with a program im writing to do subnetting i was on before about it and i got some help. the code below wont work for me and i cant think of why not. i was wondering if anyone...
5
2280
by: SStory | last post by:
Hi all, I really needed to get the icons associated with each file that I want to show in a listview. I used the follow modified code sniplets found on the internet. I have left in...
11
2990
by: Steve | last post by:
I'm hoping someone can help me out. I'm a newbie to vb.net still. I'm trying to convert the code below from VB6 to VB.NET. I'm not sure of the best way to go. This is basically a simple...
2
5025
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
4
1938
by: ItsMe | last post by:
Hi Guyz, I'm unable to understand this (AddressOf) error??? In VB6 I have two functions: ---------------------------- Public Function ImageFirstImageCallback(ByVal hWnd As Integer, ByVal...
1
1950
by: Michael D. Reed | last post by:
I am using the help class to display a simple help file. I generated the help file using Word and saving it as a single page Web page (.mht extension). I show the help file with the following...
6
1720
by: carly | last post by:
Hi, im new to java and i really need help with my assigment. I need a simple methode that will: 1- allow a member of a Internet cafe to log in to the workstation 2- log out of the workstation...
19
1893
by: yxq | last post by:
Hello, I want to get the string resource from DLL file, the code work well for Vista x86, but it will not work on Vista x64, why? can anyone help to view the code below? thank you very much. ...
13
3475
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
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...
1
7023
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
7479
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...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.