Welcome to Dream.In.Code
Become a VB Expert!

Join 137,261 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,516 people online right now. Registration is fast and FREE... Join Now!




Integer variable not populating with data

 
Reply to this topicStart new topic

Integer variable not populating with data

ednetman
4 Dec, 2006 - 11:05 AM
Post #1

New D.I.C Head
*

Joined: 4 Dec, 2006
Posts: 2


My Contributions
Help! I know I have done this before with no problems. I am probably just stressed over my Psych final and I'm missing something simple. Can somebody PLEASE tell me what I am doing wrong?

This is just one little portion of t project. I have a Numeric Up Down gathering the age of the user and I just want to pop up a message if they are under 16. I can't seem to get the value to populate down to the variable.

CODE
Private Sub BT_Apply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_Apply.Click
        Dim TB_Name, LB__Employment, LB_CreditRating, LB_HomeOwner, AgeFailed, FailedTitle As String
        Dim AppAge, NUD_Age As Integer
        'Dim WshShell, BtnCode, WScript
        AppAge = NUD_Age
        AgeFailed = "I'm sorry.  You do not meet the minimum age requirment for mebership."
        FailedTitle = "Credit Card Application Denied"

        'ReDim AppAge(NUD_Age.Value)
        'WshShell = WScript.CreateObject("WScript.Shell")
        '''' Check Age (16 or Over): Nobody under 16 can get the card.
        'If NUD_Age > "16" Then Object.Popup(AgeFailed, [FailedTitle], [0])
        'If NUD_Age > "16" Then BtnCode = WshShell.Popup("I'm sorry.  You do not meet the minimum age requirement for membership.", "Credit Card Application Denied:", 0 + 16)
        If AppAge > 16 Then
            MsgBox("I'm sorry.  You do not meet the minimum age requirement for membership.")
            'LB_Report.Items.Add("I'm sorry.  You do not meet the minimum age requirement for membership.")
        End If


As you can see, I have tried reference the control directly, and assigning a variable that references the code.

any help would be appreciated.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Integer Variable Not Populating With Data
4 Dec, 2006 - 03:00 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,985



Thanked: 44 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Currently both your variables AppAge, NUD_Age have zero stored in them. How are the ages being entered by the user currently, textbox?

If they are coming from a textbox, for example, then you need to retrieve the value stored in there and assign it to your variable. Don't forget to convert the value from a string to the correct data type.
CODE

AppAge = Convert.ToInt16(TextBox1.Text)

User is offlineProfile CardPM
+Quote Post

ednetman
RE: Integer Variable Not Populating With Data
4 Dec, 2006 - 03:59 PM
Post #3

New D.I.C Head
*

Joined: 4 Dec, 2006
Posts: 2


My Contributions
Whoops!

Thanks for staing the obvious! How does that old saying go? "If it was a snake,....."

:-)
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 06:59PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month