473,749 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling empty fields

Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After
entering the numbers, they should click a button called 'Display Results'.
How can I display a dialog box prompting the users to check their entry if
they left any of the boxes empty? I have tried the .IsNaN function but in
vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal
Nov 21 '05 #1
14 1596
Hi,

check if isnumeric(textb ox.text)
or for the length you could check textbox.text.le ngth > 0
or combine them

hth
Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After
entering the numbers, they should click a button called 'Display Results'.
How can I display a dialog box prompting the users to check their entry if
they left any of the boxes empty? I have tried the .IsNaN function but in
vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal

Nov 21 '05 #2
Xero,

To show the result from Peters actions when not
messagebox.show ("You should enter something")

I hope this helps?

Cor
"Xero" <jeff@chezjeff( REMOVE).net>
....
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After
entering the numbers, they should click a button called 'Display Results'.
How can I display a dialog box prompting the users to check their entry if
they left any of the boxes empty? I have tried the .IsNaN function but in
vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal

Nov 21 '05 #3
I see. Thanks very much.

"Peter Proost" wrote:
Hi,

check if isnumeric(textb ox.text)
or for the length you could check textbox.text.le ngth > 0
or combine them

hth
Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After
entering the numbers, they should click a button called 'Display Results'.
How can I display a dialog box prompting the users to check their entry if
they left any of the boxes empty? I have tried the .IsNaN function but in
vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal


Nov 21 '05 #4
Eh ... sorry, I still have some problem ...
I copied the line of code but it didn't work out.

Could you post the exact line of code? I want to display the message 'One of
the boxes is empty.' if any of the two boxes named as 'num1' and 'num2' is
left empty. Thanks again.

"Peter Proost" wrote:
Hi,

check if isnumeric(textb ox.text)
or for the length you could check textbox.text.le ngth > 0
or combine them

hth
Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After
entering the numbers, they should click a button called 'Display Results'.
How can I display a dialog box prompting the users to check their entry if
they left any of the boxes empty? I have tried the .IsNaN function but in
vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal


Nov 21 '05 #5
Here are 2 possible pieces of code, place it behind the click event of a
button, or where you want to check the textboxes

<<<<<<<code 1>>>>>>

If Not IsNumeric(num1. Text) Or Not IsNumeric(num2. Text) Then
MsgBox("one of the boxes is empty")
End If

<<<<<<code 1>>>>>>

<<<<<<code 2>>>>>>

Dim blnOk As Boolean
If Not IsNumeric(num1. Text) Then
blnOk = False
MsgBox("Box one is empty")
Else
blnOk = True
End If
If Not IsNumeric(num2. Text) Then
blnOk = False
MsgBox("Box two is empty")
Else
blnOk = True
End If

If blnOk Then
'execute the rest of the code
MsgBox("They're both filled")
End If

<<<<<<code 2>>>>>>>>

greetz Peter

"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:C0******** *************** ***********@mic rosoft.com...
Eh ... sorry, I still have some problem ...
I copied the line of code but it didn't work out.

Could you post the exact line of code? I want to display the message 'One of the boxes is empty.' if any of the two boxes named as 'num1' and 'num2' is
left empty. Thanks again.

"Peter Proost" wrote:
Hi,

check if isnumeric(textb ox.text)
or for the length you could check textbox.text.le ngth > 0
or combine them

hth
Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
program. My computer is running Win XP Pro.

I am writing a calculator and requires users to enter two numbers. After entering the numbers, they should click a button called 'Display Results'. How can I display a dialog box prompting the users to check their entry if they left any of the boxes empty? I have tried the .IsNaN function but in vein.

Thanks.
--
Xero

http://www.chezjeff.net
My personal web portal


Nov 21 '05 #6
Sorry but they don't work either.
The code 'num1.Text' is underlined by a blue line, saying that 'Text is not
a member of Double.'
Sorry that I forgot to tell you that both num1 and num2 are of data type
'Double'.

"Peter Proost" wrote:
Here are 2 possible pieces of code, place it behind the click event of a
button, or where you want to check the textboxes

<<<<<<<code 1>>>>>>

If Not IsNumeric(num1. Text) Or Not IsNumeric(num2. Text) Then
MsgBox("one of the boxes is empty")
End If

<<<<<<code 1>>>>>>

<<<<<<code 2>>>>>>

Dim blnOk As Boolean
If Not IsNumeric(num1. Text) Then
blnOk = False
MsgBox("Box one is empty")
Else
blnOk = True
End If
If Not IsNumeric(num2. Text) Then
blnOk = False
MsgBox("Box two is empty")
Else
blnOk = True
End If

If blnOk Then
'execute the rest of the code
MsgBox("They're both filled")
End If

<<<<<<code 2>>>>>>>>

greetz Peter

"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:C0******** *************** ***********@mic rosoft.com...
Eh ... sorry, I still have some problem ...
I copied the line of code but it didn't work out.

Could you post the exact line of code? I want to display the message 'One

of
the boxes is empty.' if any of the two boxes named as 'num1' and 'num2' is
left empty. Thanks again.

"Peter Proost" wrote:
Hi,

check if isnumeric(textb ox.text)
or for the length you could check textbox.text.le ngth > 0
or combine them

hth
Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F8******** *************** ***********@mic rosoft.com...
> Hello. I am using Visual Studio .NET (Academic Edition) to write a VB
> program. My computer is running Win XP Pro.
>
> I am writing a calculator and requires users to enter two numbers. After > entering the numbers, they should click a button called 'Display Results'. > How can I display a dialog box prompting the users to check their entry if > they left any of the boxes empty? I have tried the .IsNaN function but in > vein.
>
> Thanks.
> --
> Xero
>
> http://www.chezjeff.net
> My personal web portal


Nov 21 '05 #7
is it a windows forms application?

grtz Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
Sorry but they don't work either.
The code 'num1.Text' is underlined by a blue line, saying that 'Text is not a member of Double.'
Sorry that I forgot to tell you that both num1 and num2 are of data type
'Double'.

"Peter Proost" wrote:
Here are 2 possible pieces of code, place it behind the click event of a
button, or where you want to check the textboxes

<<<<<<<code 1>>>>>>

If Not IsNumeric(num1. Text) Or Not IsNumeric(num2. Text) Then
MsgBox("one of the boxes is empty")
End If

<<<<<<code 1>>>>>>

<<<<<<code 2>>>>>>

Dim blnOk As Boolean
If Not IsNumeric(num1. Text) Then
blnOk = False
MsgBox("Box one is empty")
Else
blnOk = True
End If
If Not IsNumeric(num2. Text) Then
blnOk = False
MsgBox("Box two is empty")
Else
blnOk = True
End If

If blnOk Then
'execute the rest of the code
MsgBox("They're both filled")
End If

<<<<<<code 2>>>>>>>>

greetz Peter

"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:C0******** *************** ***********@mic rosoft.com...
Eh ... sorry, I still have some problem ...
I copied the line of code but it didn't work out.

Could you post the exact line of code? I want to display the message 'One
of
the boxes is empty.' if any of the two boxes named as 'num1' and
'num2' is left empty. Thanks again.

"Peter Proost" wrote:

> Hi,
>
> check if isnumeric(textb ox.text)
> or for the length you could check textbox.text.le ngth > 0
> or combine them
>
> hth
> Peter
> "Xero" <jeff@chezjeff( REMOVE).net> wrote in message
> news:F8******** *************** ***********@mic rosoft.com...
> > Hello. I am using Visual Studio .NET (Academic Edition) to write a VB > > program. My computer is running Win XP Pro.
> >
> > I am writing a calculator and requires users to enter two numbers.

After
> > entering the numbers, they should click a button called 'Display

Results'.
> > How can I display a dialog box prompting the users to check their

entry if
> > they left any of the boxes empty? I have tried the .IsNaN function

but in
> > vein.
> >
> > Thanks.
> > --
> > Xero
> >
> > http://www.chezjeff.net
> > My personal web portal
>
>
>


Nov 21 '05 #8
Yes, it is.

"Peter Proost" wrote:
is it a windows forms application?

grtz Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
Sorry but they don't work either.
The code 'num1.Text' is underlined by a blue line, saying that 'Text is

not
a member of Double.'
Sorry that I forgot to tell you that both num1 and num2 are of data type
'Double'.

"Peter Proost" wrote:
Here are 2 possible pieces of code, place it behind the click event of a
button, or where you want to check the textboxes

<<<<<<<code 1>>>>>>

If Not IsNumeric(num1. Text) Or Not IsNumeric(num2. Text) Then
MsgBox("one of the boxes is empty")
End If

<<<<<<code 1>>>>>>

<<<<<<code 2>>>>>>

Dim blnOk As Boolean
If Not IsNumeric(num1. Text) Then
blnOk = False
MsgBox("Box one is empty")
Else
blnOk = True
End If
If Not IsNumeric(num2. Text) Then
blnOk = False
MsgBox("Box two is empty")
Else
blnOk = True
End If

If blnOk Then
'execute the rest of the code
MsgBox("They're both filled")
End If

<<<<<<code 2>>>>>>>>

greetz Peter

"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:C0******** *************** ***********@mic rosoft.com...
> Eh ... sorry, I still have some problem ...
> I copied the line of code but it didn't work out.
>
> Could you post the exact line of code? I want to display the message 'One of
> the boxes is empty.' if any of the two boxes named as 'num1' and 'num2' is > left empty. Thanks again.
>
> "Peter Proost" wrote:
>
> > Hi,
> >
> > check if isnumeric(textb ox.text)
> > or for the length you could check textbox.text.le ngth > 0
> > or combine them
> >
> > hth
> > Peter
> > "Xero" <jeff@chezjeff( REMOVE).net> wrote in message
> > news:F8******** *************** ***********@mic rosoft.com...
> > > Hello. I am using Visual Studio .NET (Academic Edition) to write a VB > > > program. My computer is running Win XP Pro.
> > >
> > > I am writing a calculator and requires users to enter two numbers.
After
> > > entering the numbers, they should click a button called 'Display
Results'.
> > > How can I display a dialog box prompting the users to check their
entry if
> > > they left any of the boxes empty? I have tried the .IsNaN function but in
> > > vein.
> > >
> > > Thanks.
> > > --
> > > Xero
> > >
> > > http://www.chezjeff.net
> > > My personal web portal
> >
> >
> >


Nov 21 '05 #9
when do you place the entered values in the double variables?

I propbably wont be able to reply anymore untill tomorrow

grtz peter

"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:F9******** *************** ***********@mic rosoft.com...
Yes, it is.

"Peter Proost" wrote:
is it a windows forms application?

grtz Peter
"Xero" <jeff@chezjeff( REMOVE).net> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
Sorry but they don't work either.
The code 'num1.Text' is underlined by a blue line, saying that 'Text is
not
a member of Double.'
Sorry that I forgot to tell you that both num1 and num2 are of data
type 'Double'.

"Peter Proost" wrote:

> Here are 2 possible pieces of code, place it behind the click event of a > button, or where you want to check the textboxes
>
> <<<<<<<code 1>>>>>>
>
> If Not IsNumeric(num1. Text) Or Not IsNumeric(num2. Text) Then
> MsgBox("one of the boxes is empty")
> End If
>
> <<<<<<code 1>>>>>>
>
> <<<<<<code 2>>>>>>
>
> Dim blnOk As Boolean
> If Not IsNumeric(num1. Text) Then
> blnOk = False
> MsgBox("Box one is empty")
> Else
> blnOk = True
> End If
> If Not IsNumeric(num2. Text) Then
> blnOk = False
> MsgBox("Box two is empty")
> Else
> blnOk = True
> End If
>
> If blnOk Then
> 'execute the rest of the code
> MsgBox("They're both filled")
> End If
>
> <<<<<<code 2>>>>>>>>
>
> greetz Peter
>
>
>
> "Xero" <jeff@chezjeff( REMOVE).net> wrote in message
> news:C0******** *************** ***********@mic rosoft.com...
> > Eh ... sorry, I still have some problem ...
> > I copied the line of code but it didn't work out.
> >
> > Could you post the exact line of code? I want to display the message 'One
> of
> > the boxes is empty.' if any of the two boxes named as 'num1' and

'num2' is
> > left empty. Thanks again.
> >
> > "Peter Proost" wrote:
> >
> > > Hi,
> > >
> > > check if isnumeric(textb ox.text)
> > > or for the length you could check textbox.text.le ngth > 0
> > > or combine them
> > >
> > > hth
> > > Peter
> > > "Xero" <jeff@chezjeff( REMOVE).net> wrote in message
> > > news:F8******** *************** ***********@mic rosoft.com...
> > > > Hello. I am using Visual Studio .NET (Academic Edition) to
write a VB
> > > > program. My computer is running Win XP Pro.
> > > >
> > > > I am writing a calculator and requires users to enter two
numbers. > After
> > > > entering the numbers, they should click a button called 'Display > Results'.
> > > > How can I display a dialog box prompting the users to check their > entry if
> > > > they left any of the boxes empty? I have tried the .IsNaN

function but
> in
> > > > vein.
> > > >
> > > > Thanks.
> > > > --
> > > > Xero
> > > >
> > > > http://www.chezjeff.net
> > > > My personal web portal
> > >
> > >
> > >
>
>
>


Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2101
by: Glyphman | last post by:
I have a bunch of pages with long forms, with lots of input types-text, radios, textareas, and the debugging process has become overwhelming. What I need to happen is to make sure that 1. Every field on the page is filled out-if not, a list of incorrect fields is displayed, and any radio boxes that were checked still are 2. The fields are queried to a table in a database. (The table has the same column names as the field names) Here's...
12
3690
by: Ritz, Bruno | last post by:
hi in java i found that when a method has a throws clause in the definition, callers must either handle the exceptions thrown by the method they are calling or "forward" the exception to the caller by specifying a throws clause as well. is there a similar machanism in c++? i want to force a developer to write handlers for all possible exceptions a method of my class library can throw.
4
2820
by: John Fereira | last post by:
So, one of the limitations of multipart-form handling is that when an <input type="file" ..> tag is used it will bring up a window which allows a user to select a file for upload but won't allow the user to select multiple files. As you may know, the tag produces a text input field with an adjacent button for selecting a file from the local file system. As I would like to be able to allow the user to upload an arbitrary number of files...
5
24637
by: Krechting | last post by:
Hi ALl, I have a code that checks if the documents in a hyperlink field are still where they should be. I use fileexist(). First I want to filter out all the hyperlink fields that are empty. I open a recordset and browse through all the fields to check for the word file. I cannot filter out the empty fields. I have tried: If Len(.Fields("Link") <> 0 then and: If Not IsNull(.Fields("Link")) then
11
4154
by: wolfesimon | last post by:
I have a form where the user copies a handwritten contract into a text field "Contract1". The contract usually exeeds 255 characters. Therefore I provided "Contract2", "Contract3", and "Contract4" fields. When "Contract1" cannot accept further input, the user continues on to "Contract2", ect. I don't want to use memo fields for obvious reasons. Does anyone have an event procedure and code, which could monitor
7
3468
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
5
5087
by: wendyzhakata | last post by:
you are required to keep tailoring records of fellow students in your class. each record is made up of the following fields: (a)Fname: a character array of maximum15 characters representing the first name of the student (b)Sname: a character array of maximum 18 characters representing the surname of the student (c)Dob: a character array entered as dd/mm/yyyy representing the date of birth of the student (d)Height: a float representing the...
3
7887
by: Christopher Mocock | last post by:
Hi all, Bit of a python newbie so need a little help with a CGI script I'm trying to write. I've got it working fine as long as the fields of the form are filled in correctly, however I need to be able to accept blank entries. Therefore I want to convert any empty entries to an empty string. For example, if I call the following CGI script as: http://localhost/cgi-bin/test.cgi?myfield=hello
3
4051
by: GazK | last post by:
I am hoping someone can steer me towards an elegant solution to a simple problem. I have a query result which returns an array of details about a physical building, including its address. The relevant fields are: $row $row $row $row
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3319
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 we have to send another system

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.