473,405 Members | 2,444 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,405 software developers and data experts.

Isnumeric in all texbox

10
I have a situation i have a problem to solve my surveying data. Now i want it to respond to data which i input e.g if i put text not a value should make me aware and where i did that mistake.Below is the programme please assist

Private Sub Cmd_Convert_Click(Index As Integer)
'Convert Value in Txt_Degrees
Dim Degrees As Double, Minutes As Double, Seconds As Double, DecDeg As Double
Dim BearingDec As Double, BearingMin As Double, BearingSec As Double
Dim VertDec As Double, VertMin As Double, VertSec As Double
If Not IsNumeric(Txt_Degrees.Text) Then
MsgBox "no number"
End If
Degrees = Val(Txt_Degrees.Text)
Minutes = Val(Txt_Minutes.Text)
Seconds = Val(Txt_Seconds.Text)
BearingDec = Val(Txt_BearingDec.Text)
BearingMin = Val(Txt_BearingMin.Text)
BearingSec = Val(Txt_BearingSec.Text)
'Convert Value in Txt_Degrees
DecDeg = Degrees + Minutes / 60 + Seconds / 3600
DecDegAngle = BearingDec + BearingMin / 60 + BearingSec / 3600

'Display in Label field
Txt_DecDeg.Text = Str(DecDeg)
Txt_InitialAngleToRO.Text = Format(Str(DecDegAngle), "##0.000000")
Oct 22 '08 #1
6 1559
debasisdas
8,127 Expert 4TB
why not simply restrict the input of alphabet and special characters.
Oct 22 '08 #2
Rakodu
10
why not simply restrict the input of alphabet and special characters.
Thank you a lot but still the problem is not solved. Im a student and yhis is my second week in VB so some languages are not familier with them. How do i restrict the input of alphabet and special characters in regard to my programme
Oct 22 '08 #3
Assume here txt1 is a textbox for data entry:

now put the following code in your project.


Private Sub txt1_KeyPress(KeyAscii As Integer)
b = KeyAscii
If b >= 48 And b <= 57 Or b = 8 Or b = 46 Then
KeyAscii = b
Else: KeyAscii = 0
End If
End Sub


it will work. I am using the same.

if your text box name is not txt1 & suppose you have rename it to xyz then replace txt1_keypress to xyz_keypress.

I hope, this will solve your problem.
Oct 23 '08 #4
smartchap
236 100+
for each textbox input u can use the code posted by Mr. DixitSolanki or in your code after checking IsNumeric for each textbox u must exit the subroutine after displaying warning message that data in a particular textbox is not numeric and setfocus to that textbox and exit that click event. After a new value is filled again user must click the button.
Oct 23 '08 #5
Rakodu
10
Thanks its working wonders i appreciate the time you took assisting me
Oct 24 '08 #6
Rakodu
10
Thanks i did exactly that and its working
Oct 24 '08 #7

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

Similar topics

8
by: eje | last post by:
IsNumeric(value) should return false if value "can not be successfully converted to a Double." Instead I get the following error message: "Input string was not in a correct format." I use the...
4
by: Eugene Anthony | last post by:
I have received the following feedback for the two functions bellow: "The ISNUMERIC test is WORTHLESS for checking for an INT value, because ISNUMERIC will happily accept DOUBLE values, such as...
14
by: Kenny | last post by:
Hello, I would like to know if the function IsNumeric requires a header like #include <iostream> to be functionnal thanks ken
8
by: John Bowman | last post by:
Hello, Does anyone have a good/reliable approach to implementing an IsNumeric() method that accepts a string that may represent a numerical value (eg. such as some text retrieved from an XML...
7
by: Nathan Truhan | last post by:
All, I think I may have uncovered a bug in the IsNumeric function, or at least a misunderstanding on functionality. I am writing a Schedule Of Classes Application for our campus and have a...
8
by: moondaddy | last post by:
What's the .net framework equivalent of the vb function isnumeric? If there isn't one, how can I test a string variable to see if its a number or not? I don't want to use isnumeric if possible ...
12
by: sck10 | last post by:
Hello, I am trying to determine if a value is NOT numeric in C#. How do you test for "Not IsNumeric"? protected void fvFunding_ItemInserting_Validate(object sender, FormViewInsertEventArgs...
12
by: Paul | last post by:
Hi, I am trying to check a string to see if it's first 3 characters are numeric and if they are, to replace those 3 characters with something else. I've tried this but nothing happens... ...
17
by: MLH | last post by:
I have tested the following in immed window: ?isnumeric(1) True ?isnumeric(1.) True ?isnumeric(1.2) True ?isnumeric(1.2.2)
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.