Visual basic being gay lol

Started on the old forum in June 2011 · view the original in the archive · old links redirect here

3 replies · 513 views · started 15 years ago · 8 min read

3 participants
crazybrumi Super moderator Principal · 1,064 posts #1

right i did some coding a few years ago in visual basic, and im haivng to do something again which will use a simular principle. Basically i want to store what ever i put in a text box so even i close the page it will still appear this is some old coding which works

Public Class FrmExchange
    Inherits System.Windows.Forms.Form

    Private Sub BtnSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSub.Click
        If TxbPassword.Text = "manager125" Then  'The pasword set
            Pnlrates.Enabled = True              'Enables  Panel
            TxbPassword.Clear()                  'clears Text messae once panel is enable and when you close the form
        Else
            MsgBox("Error Please Check Password Has Been Entered Correctly", MsgBoxStyle.OKOnly)
            TxbPassword.Clear()  ' Clears the password field
            TxbPassword.Focus()  ' Returns the cursor to password field
        End If
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        Pnlrates.Enabled = False  'Disables  Panel
        Me.Hide()  ' closes the Form
    End Sub

    Private Sub Txt_Euro_P_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Txt_Euro_P.LostFocus
        If IsNumeric(Txt_Euro_P.Text) Then
            Txt_Euro_P.Focus()          ' Puts Cursor Back On Euro_P
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly)
            Txt_Euro_P.Clear()  ' closes the Euro_P Text Box
            Txt_Euro_P.Focus()  ' Puts Cursor Back On Euro_P
        End If                  ' End Statement
    End Sub

    Private Sub Txt_Dkk_P_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Dkk_P.TextChanged
        If IsNumeric(Txt_Dkk_P.Text) Then ' if Txt_Dkk_P has an numeric number in it then
            Txt_Dkk_P.Focus()           ' Puts Cursor Back On Txt_Dkk_P
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly) 'display error message
            Txt_Dkk_P.Clear()           ' closes the DKK_P Text Box
            Txt_Dkk_P.Focus()           ' Puts Cursor Back On Txt_Dkk_P
        End If                          ' End Statement
    End Sub

    Private Sub Txt_Skk_P_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Skk_P.TextChanged
        If IsNumeric(Txt_Skk_P.Text) Then  ' if Txt_Skk_P has an numeric number in it then
            Txt_Skk_P.Focus()           ' Puts Cursor Back On Txt_Skk_P
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly) 'display error message
            Txt_Skk_P.Clear()           ' closes the SKK_P Text Box
            Txt_Skk_P.Focus()           ' Puts Cursor Back On Txt_Skk_P
        End If                          ' End Statement
    End Sub

    Private Sub Txt_euro_F_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_euro_F.TextChanged
        If IsNumeric(Txt_euro_F.Text) Then  ' if Txt_euro_F has an numeric number in it then
            Txt_euro_F.Focus()          ' Puts Cursor Back On Txt_euro_F
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly) 'display error message
            Txt_euro_F.Clear()          ' closes the Euro_f Text Box
            Txt_euro_F.Focus()          ' Puts Cursor Back On Txt_euro_F
        End If
    End Sub

    Private Sub Txt_Dkk_f_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Dkk_f.TextChanged
        If IsNumeric(Txt_Dkk_f.Text) Then   ' if Txt_Dkk_f has an numeric number in it then
            Txt_euro_F.Focus()              ' Puts Cursor Back On Txt_euro_F
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly)  'display error message
            Txt_Dkk_f.Clear()            ' closes the DKK_f Text Box
            Txt_Dkk_f.Focus()            ' Puts Cursor Back On 
        End If                           ' End Statement
    End Sub

    Private Sub Txt_Skk_F_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Skk_F.TextChanged
        If IsNumeric(Txt_Skk_F.Text) Then   ' if Txt_skk_f has an numeric number in it then
            Txt_Skk_F.Focus()           ' Puts Cursor Back On Txt_Skk_F
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OKOnly)  'display error message
            Txt_Skk_F.Clear()           ' closes the SKK_f Text Box
            Txt_Skk_F.Focus()           ' Puts Cursor Back On Txt_Skk_F
        End If                          ' End Statement
    End Sub

End Class

however this one bellow doesn't and ideas

Public Class Frm_Prices
    Inherits System.Windows.Forms.Form

    Private Sub Btn_Auth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Auth.Click
        If Txt_Password.Text = "Password1" Then  'The pasword set
            Pnl_Prices.Enabled = True            'Enables  Panel
            Txt_Password.Clear()                 'Clears Text messae once panel is enable and when you close the form
        Else
            MsgBox("Error Please Check Password Has Been Entered Correctly", MsgBoxStyle.OkOnly)
            Txt_Password.Clear()  ' Clears the password field
            Txt_Password.Focus()  ' Returns the cursor to password field
        End If
    End Sub

    Private Sub Txt_Gent_Mount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Gent_Mount.TextChanged
        If IsNumeric(Txt_Gent_Mount.Text) Then
            Txt_Gent_Mount.Focus()  ' Puts Cursor Back On Txt_Gent_Mount
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Gent_Mount.Clear()  ' Clears Txt_Gent_Mount Textbox
            Txt_Gent_Mount.Focus()  ' Puts Cursor Back On Txt_Gent_Mount
        End If
    End Sub

    Private Sub Txt_Gents_Road_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Gents_Road.TextChanged
        If IsNumeric(Txt_Gents_Road.Text) Then
            Txt_Gents_Road.Focus()  ' Puts Cursor Back On Txt_Gents_Road
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Gents_Road.Clear()  ' Clears Txt_Gents_Road Textbox
            Txt_Gents_Road.Focus()  ' Puts Cursor Back On Txt_Gents_Road
        End If
    End Sub

    Private Sub Txt_Ladies_Mount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Ladies_Mount.TextChanged
        If IsNumeric(Txt_Ladies_Mount.Text) Then
            Txt_Ladies_Mount.Focus()  ' Puts Cursor Back On Txt_Ladies_Mount
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Ladies_Mount.Clear()  ' Clears Txt_Ladies_Mount Textbox
            Txt_Ladies_Mount.Focus()  ' Puts Cursor Back On Txt_Ladies_Mount
        End If
    End Sub

    Private Sub Txt_Ladies_Road_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Ladies_Road.TextChanged
        If IsNumeric(Txt_Ladies_Road.Text) Then
            Txt_Ladies_Road.Focus()  ' Puts Cursor Back On Txt_Ladies_Road
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Ladies_Road.Clear()  ' Clears Txt_Ladies_Road Textbox
            Txt_Ladies_Road.Focus()  ' Puts Cursor Back On Txt_Ladies_Road
        End If
    End Sub

    Private Sub Txt_Boys_Mount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Boys_Mount.TextChanged
        If IsNumeric(Txt_Boys_Mount.Text) Then
            Txt_Boys_Mount.Focus()  ' Puts Cursor Back On Txt_Boys_Mount
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Boys_Mount.Clear()  ' Clears Txt_Boys_Mount Textbox
            Txt_Boys_Mount.Focus()  ' Puts Cursor Back On Txt_Boys_Mount
        End If
    End Sub

    Private Sub Txt_Boys_Road_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Boys_Road.TextChanged
        If IsNumeric(Txt_Boys_Road.Text) Then
            Txt_Boys_Road.Focus()  ' Puts Cursor Back On Txt_Boys_Road
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Boys_Road.Clear()  ' Clears Txt_Boys_Road Textbox
            Txt_Boys_Road.Focus()  ' Puts Cursor Back On Txt_Boys_Road
        End If
    End Sub

    Private Sub Txt_Girls_Mount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Girls_Mount.TextChanged
        If IsNumeric(Txt_Girls_Mount.Text) Then
            Txt_Girls_Mount.Focus()  ' Puts Cursor Back On Txt_Girls_Mount
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Girls_Mount.Clear()  ' Clears Txt_Girls_Mount Textbox
            Txt_Girls_Mount.Focus()  ' Puts Cursor Back On Txt_Girls_Mount
        End If
    End Sub

    Private Sub Txt_Girls_Road_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Girls_Road.TextChanged
        If IsNumeric(Txt_Girls_Road.Text) Then
            Txt_Girls_Road.Focus()  ' Puts Cursor Back On Txt_Girls_Road
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Girls_Road.Clear()  ' Clears Txt_Girls_Road Textbox
            Txt_Girls_Road.Focus()  ' Puts Cursor Back On Txt_Girls_Road
        End If
    End Sub

    Private Sub Txt_Vat_Rate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Vat_Rate.TextChanged
        If IsNumeric(Txt_Vat_Rate.Text) Then
            Txt_Vat_Rate.Focus()  ' Puts Cursor Back On Txt_Vat_Rate
            Vat_Rate = Txt_Vat_Rate.Text
        Else
            MsgBox("Please Enter a Numeric Rate", MsgBoxStyle.OkOnly)
            Txt_Vat_Rate.Clear()  ' Clears Txt_Vat_Rate Textbox
            Txt_Vat_Rate.Focus()  ' Puts Cursor Back On Txt_Vat_Rate
        End If
    End Sub

    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
        Pnl_Prices.Enabled = False  'Disables  Panel
        Me.Hide()                   'Hides the current Page
    End Sub

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

asidana Junior · 42 posts #2

This code is part of widows form application, what do you mean by when i close the page? If you want to keep the data after closing the application, your would be better to save it on a db.

If you are talking a bout a child form or another form in the application you should be able to keep it by hiding the form without terminating it

spiritbreaker69 Junior · 12 posts #4

Yeah use addoc or data environment..

"Up, Up, Down, Down, Left, Right, Left, Right, SELECT, START AB"

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close