Click here to Skip to main content
15,914,500 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? [modified] Pin
redjoy9-Dec-07 10:26
redjoy9-Dec-07 10:26 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? Pin
Dave Kreskowiak10-Dec-07 2:02
mveDave Kreskowiak10-Dec-07 2:02 
GeneralRe: What is the best way to write the same VBA code for multiple Excel workbooks? Pin
hwahlberg10-Feb-08 10:24
hwahlberg10-Feb-08 10:24 
GeneralCreate log file Pin
nishkarsh_k7-Dec-07 6:38
nishkarsh_k7-Dec-07 6:38 
GeneralRe: Create log file Pin
nlarson117-Dec-07 8:33
nlarson117-Dec-07 8:33 
GeneralRe: Create log file Pin
Mark Churchill7-Dec-07 14:44
Mark Churchill7-Dec-07 14:44 
GeneralSigning a User Control Pin
Andy Dale7-Dec-07 3:39
Andy Dale7-Dec-07 3:39 
GeneralPassword Problem Pin
Dave McCool7-Dec-07 2:21
Dave McCool7-Dec-07 2:21 
I have a form which has a button called "Modify Intrest" and when you click it, it brings up a password box and asks for the password. What I wanted was if password was typed in wrong three times, a message to display and then when you click OK, the application to close.

If you type the password in correctly, I want an intrest rate box to display and you have to type in a number and it is written to a file ir.txt

Here is code I have:

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click<br />
<br />
        If txtIntrest.Text = ("") Then<br />
            MsgBox("Please Enter Intrest Rate", MsgBoxStyle.Exclamation)<br />
            Exit Sub<br />
        End If<br />
<br />
<br />
        If Not txtIntrest.Text.Equals(myline) Then<br />
<br />
<br />
<br />
            Static passnum As Integer<br />
            Do<br />
                Dim pass As String = InputBox("Enter the Password", "Enter Password", "", )<br />
<br />
<br />
                If pass = "Password" Then<br />
<br />
                    Dim intrest As String = InputBox("Enter The New Intrest", "Enter Intrest Rate", "", )<br />
<br />
                    txtIntrest.Text = (intrest)<br />
                   <br />
                    Dim theFile As FileStream = File.Create("ir.txt")<br />
                    Dim writer As StreamWriter = New StreamWriter(theFile)<br />
                    writer.WriteLine(txtIntrest.Text)<br />
                    writer.Close()<br />
                    theFile.Close()<br />
                    Exit Sub<br />
                    Exit Do<br />
                Else<br />
                     Loop Until passnum = 3<br />
            passnum = +1<br />
        End If<br />
<br />
        MsgBox("You have had three attempts to input password, Program will now close for security reasons", MsgBoxStyle.Critical)<br />
        Application.Exit()<br />
<br />
     <br />
<br />
<br />
<br />
<br />
                End If<br />
<br />
    End Sub


I messed it up slightly and not sure how to fix it, any ideas?

In the end we're all just the same

GeneralRe: Password Problem Pin
Christian Graus7-Dec-07 10:53
protectorChristian Graus7-Dec-07 10:53 
GeneralRe: Password Problem Pin
Dave McCool8-Dec-07 1:37
Dave McCool8-Dec-07 1:37 
GeneralEnding a VB Program Pin
Dreamer20077-Dec-07 1:11
Dreamer20077-Dec-07 1:11 
GeneralRe: Ending a VB Program Pin
CPallini7-Dec-07 2:19
mveCPallini7-Dec-07 2:19 
QuestionURGENT: Export to excel and special characters Pin
buzzvishwanath6-Dec-07 22:47
buzzvishwanath6-Dec-07 22:47 
GeneralRe: URGENT: Export to excel and special characters Pin
coolestCoder7-Dec-07 4:40
coolestCoder7-Dec-07 4:40 
GeneralRe: URGENT: Export to excel and special characters Pin
leckey7-Dec-07 8:03
leckey7-Dec-07 8:03 
GeneralRe: URGENT: Export to excel and special characters Pin
Paul Conrad7-Dec-07 14:43
professionalPaul Conrad7-Dec-07 14:43 
GeneralUser defined DataTypes Pin
gilchinger6-Dec-07 21:21
gilchinger6-Dec-07 21:21 
GeneralRe: User defined DataTypes Pin
gilchinger7-Dec-07 1:14
gilchinger7-Dec-07 1:14 
QuestionDLL & XML Resource.... Pin
Dhanraj6-Dec-07 20:03
Dhanraj6-Dec-07 20:03 
GeneralRe: DLL & XML Resource.... Pin
Paul Conrad8-Dec-07 5:39
professionalPaul Conrad8-Dec-07 5:39 
QuestionCheck the .xml file format in vb Pin
kripa216-Dec-07 18:45
kripa216-Dec-07 18:45 
GeneralRe: Check the .xml file format in vb Pin
pmarfleet6-Dec-07 21:22
pmarfleet6-Dec-07 21:22 
GeneralRe: Check the .xml file format in vb Pin
kripa2127-Dec-07 20:36
kripa2127-Dec-07 20:36 
GeneralOutlook programming Pin
manisghouri6-Dec-07 12:24
manisghouri6-Dec-07 12:24 
Questionis there any SVG parser or converter to raster ? Pin
mehdi00166-Dec-07 10:31
mehdi00166-Dec-07 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.