VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 31
Thread
  1. I'm new to VB, a newbie could even help me.


    I want the user to see a new screen after the the person enters in a password and presses enter. Simply put, I want to clear that form and have a new one show up so I can go from there. I've got the (basic)password part down but what should I do from there?



    Current code: (for cmdEnter_Click() )
    _______________________________________


    Private Sub cmdEnter_Click()

    If txt1.Text = "" Then
    MsgBox "You must enter the password.", vbCritical
    Exit Sub
    End If

    If txt1.Text = "Xpass" Then
    MsgBox "You are logged in!", vbExclamation
    'SHOULD CODE GO HERE?
    Exit Sub
    Else
    MsgBox "Please enter the correct password!", vbCritical
    End If


    End Sub

    ________________________________


    Also, how do I change this text? :

    Quote Quote  
  2. Member
    Join Date
    Mar 2003
    Location
    Uranus
    Search Comp PM
    The text in the form frame is a property. "name" maybe ?
    Do you want to change it at design time or run time ?

    most things have "visible" property

    It's been a while , What generally do you want to do.?

    Ok I just made a 2 form program
    form1 has a button that toggles the visibility of form2

    Private Sub Command1_Click()
    Form2.Visible = Not Form2.Visible
    End Sub
    Quote Quote  
  3. Member
    Join Date
    Aug 2003
    Location
    Des Moines, Iowa USA
    Search Comp PM
    To use a custom title for your message box:

    MsgBox "You are logged in!", vbExclamation, "Custom Title goes here"

    Now that was easy, wasn't it
    Open WIDE for Chunky!!!
    Quote Quote  
  4. Thanks juggernaut...does anyone know how to do the first task?
    Quote Quote  
  5. Member
    Join Date
    Aug 2003
    Location
    Des Moines, Iowa USA
    Search Comp PM
    Create another form for what you want the user to see after entering the correct password (let's call it frmCorrect) and use the .Show command inside your if statement.

    If txt1.Text = "Xpass" Then
    MsgBox "You are logged in!", vbExclamation
    frmCorrect.Show
    Exit Sub
    Else
    MsgBox "Please enter the correct password!", vbCritical
    End If

    You can use the .Hide command or "Unload Me" to close your first form:

    frmName.Hide 'Hides form "frmName" keeping the value of any controls on the form
    Unload Me 'Unloads the form, clearing all values of controls
    Open WIDE for Chunky!!!
    Quote Quote  
  6. Try this:

    1) Create a project.
    2) In the properties set the Form Visible to False
    3) Add for event this in load:

    Private Sub Form_Load()
    Dim szPassword As String

    szPassword = InputBox("Enter Password", "Security")

    If (szPassword = "FRED") Then
    '-Unlock Allow to fall through
    Me.Visible = True
    Else
    '- Beep wrong answer! It stops here!
    Me.Visible = True
    End
    End If

    End Sub

    This will hid the Form. Ask the user a queston. IF correct show the Form else kill the program.

    Could do this instead of the If/endif:

    ------- Start of code

    dim iRetrys as integer
    dim bFinished as boolean

    iRetries = 5 ' Good even human number for wrong trys
    bFinished = false

    while ( not bFinished )
    szPassword = InputBox("Enter Password", "Security")

    If (szPassword = "FRED") Then
    '-Unlock Allow to fall through
    bFinished = true
    Else
    '- Beep wrong answer! It stops here!
    iRetries = iRetries - 1
    if ( iRetries <= 0 ) then
    bFinished = true
    End if
    End If

    wend

    '- See if any chances are left
    if ( iRetries > 0 ) then
    me.visible = true ' Its alive! Activate main Form!
    else
    end ' Its dead Jim
    endif

    ---------------- End of code

    Be nice if we had tabs for this.

    PS: Made goof of iRetry instead of iRetries at test!
    Quote Quote  
  7. Renegade gll99's Avatar
    Join Date
    May 2002
    Location
    Canadian Tundra
    Search Comp PM
    Instead of a msgbox you can use a form to show a msg. Just set the borderstyle to 0 (none) and blank the caption. The form will display without a title bar when you make it visible. All you need to do is set the background color to whatever you like and use a label with a transparent background to write your msg. If you use a timer control you can have the "successful logon msg display for a set time then hide it or unload when time expires and then set your next form's property to visible.

    P.s. Just like any other form, you can position this "msg form" anywhere on the screen. The beauty of this method is that you can add color and graphics and all kinds of effects to your custom message.
    Quote Quote  
  8. Member
    Join Date
    Oct 2003
    Location
    Texas
    Search Comp PM
    Man,
    Get a book, they are for sale in every bookstore. VB is getting obsolete.
    Quote Quote  
  9. Member
    Join Date
    Mar 2003
    Location
    Uranus
    Search Comp PM
    So what isn't
    You propose C# ?
    Quote Quote  
  10. Member
    Join Date
    Oct 2003
    Location
    Texas
    Search Comp PM
    C# is a good choice. If you have visual studio it's as easier as VB and way more powerful. You can get the compiler for free.

    But it's better to get a book and start from there. Get a used one!
    Quote Quote  
  11. Hum I though it was VB .net that was dead out of the starting gate? Vb is usualy used for quicky stuff.

    C# is nice but not standard on anything but MS world.
    Quote Quote  
  12. Member
    Join Date
    Mar 2003
    Location
    Uranus
    Search Comp PM
    What ! something free from microsoft ? Where ?
    Quote Quote  
  13. Member
    Join Date
    Oct 2003
    Location
    Texas
    Search Comp PM
    Well the compiler is a command prompt app.
    Quote Quote  
  14. Microsoft and free usualy dont go together.

    Current price of C# is around 100 dollars for one user.
    Quote Quote  
  15. Member
    Join Date
    Mar 2003
    Location
    Uranus
    Search Comp PM
    And what do you need with that to actually do anything.
    I have a 2 yr old .NET installation from my job.
    I don't know what it cost but it came on 2 DVDs

    Can you get a C# with a VB-like IDE ? or is it the whole .NET thing.

    They ruined VB . Actually they fixed it but , they destroyed a lot of
    previous work.
    Quote Quote  
  16. You could upgrad old code through different VB untill .net.

    Though that C# was VB style ontop of C/C++. Dont use it. VC 6 and VB6 handles most of my clients needs.

    Cant remember but the full package is expensive.
    Quote Quote  
  17. Member
    Join Date
    Oct 2003
    Location
    Texas
    Search Comp PM
    Though that C# was VB style ontop of C/C++. Dont use it. VC 6 and VB6 handles most of my clients needs.
    Good advice!, learn something is goin to be obsolete. Have u used c# or Vb.net? It has way more functionality than VB6.

    Can you do real OOP in VB6? threading? advance File System operations? Man, u need to read more. C# is easier than C++ but a little more difficult than VB6.

    The only problem is getting Visual studio, but u can use some free editors
    Check this http://www.gotdotnet.com/ -> good site.
    Quote Quote  
  18. The real key thing is "How to Program". Using any programming language is a small matter. Using a libarary or concept is also a small matter. Some are better some are worse but knowing "How to Program" or should say "thinking" is the key. Like the difference between a cook and a chef.

    Getting back on subject:

    g_shocker182. How did it turn out? Did you get the task done? Or are you having other problems?
    Quote Quote  
  19. Originally Posted by NightWing
    g_shocker182. How did it turn out? Did you get the task done? Or are you having other problems?
    It worked. Feeling retarded that I didn't see the add form option.

    Thanks!
    Quote Quote  
  20. By the way, what do you guys use your programmer experience for? I find that C++ stuff, c# or whatever incredibly diifficult to understand..like learning Chinese when all you know is Basque.
    Quote Quote  
  21. Glad you got your problem solved! That is the main thing!

    Have done just about everthing I guess. From mutiple business, games, telementry, databases and even Military programs for various clients over the decades.

    C and its varrants are a bit strange. It takes the best of a high level language with the power of an assembler.
    Quote Quote  
  22. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Hi guys. I was searching around, and finally came across this topic,
    though its old. I thought I'd use it since the title says it all.
    Maybe I (and others) will use it for future inquiries.

    Anyways.

    Probably a really dumb question.. but its been a long time since I
    used VB for much anything these days. Some things you do forget,
    though I vaugly remember this one.. don't know the purpose of this one.

    Some examples:

    BUFFER = String(256, Chr$(65))
    strFileTitle = String(256, 0)

    What exactly is the above doing ??
    So that I can create a Delphi equivalent, please.

    Thanks.

    -vhelp 4079
    Quote Quote  
  23. Member
    Join Date
    Aug 2002
    Location
    cleveland, oh
    Search Comp PM
    Originally Posted by g_shocker182
    By the way, what do you guys use your programmer experience for? I find that C++ stuff, c# or whatever incredibly diifficult to understand..like learning Chinese when all you know is Basque.
    As a professional programmer with over 30 yrs. experience I can assure you that C/C++ are widely used. As my work is mainly with embedded systems I see little C# or JAVA. We generally leave these type of languages to the "script kiddies". For critical applications there is still some assembler work done mostly embeded in the C/C++ source.
    There is a lot of interest in PROLOG used mostly in the SW test area.

    The question of how to learn to program is a diffcult one to answer. In todays world most the detail theory behind programing will not be covered until grad school.

    With that said I am pleased that you are trying to learn. VB is a good start. There are many books on Comp Science that will help fill in the theory.

    If you have any other question I will be glad to try and answer them.
    Quote Quote  
  24. If memory serves the first creates a Variant named BUFFER containing 256 lower case a's. The second creates a Variant named strFileTitle contaiing 256 null characters, but will probably just return Null.
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  25. Renegade gll99's Avatar
    Join Date
    May 2002
    Location
    Canadian Tundra
    Search Comp PM
    sorry jameshgross but I have to... Hope they teach reading skills with C and C++.......

    Don't get upset it's just a joke. I too was caught answering a very old post after someone resurrected it many years later.

    @vhelp
    BUFFER = String(256, Chr$(65))
    strFileTitle = String(256, 0)


    Looks like the programmer is trying to load a string variable called BUFFER with 256 "A" since CHR(65) is the code for "A". He could have also just used "65".

    For the strFileTitle = String(256, 0) , Written this way it looks like he is blanking the strFileTitle variable with nulls. If he had put "0" then it would have written zeroes.

    edit
    @gadgetguy ... too busy laughing while writing and eating that you posted while I was away and before I pushed send... same thought
    Quote Quote  
  26. Actually those would be uppercase 'A's. Lowercase 'a' is 97.

    EDIT: Whoops, gll99 pointed out the 'A' thing while I was posting.
    Quote Quote  
  27. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Ok. Thanks guys. I have another question. Get your thinking
    caps on for this one, cause it's a VB -to- Delphi porting question..

    -vhelp 4080
    Quote Quote  
  28. Member tekkieman's Avatar
    Join Date
    Mar 2004
    Location
    Over the hill
    Search Comp PM
    Originally Posted by jameshgross
    Originally Posted by g_shocker182
    By the way, what do you guys use your programmer experience for? I find that C++ stuff, c# or whatever incredibly diifficult to understand..like learning Chinese when all you know is Basque.
    As a professional programmer with over 30 yrs. experience I can assure you that C/C++ are widely used. As my work is mainly with embedded systems I see little C# or JAVA. We generally leave these type of languages to the "script kiddies".
    While hopefully avoiding a potential flame war....

    I am also a professional programmer (just not old enough to have over 30 years experience :P ) We are a small company, but we also have over $10M in annual sales. All of our products are developed in C++, C#, and JAVA (it's not just for "script kiddies").

    That said, personal preferences in programming languages are much like the "taste great/less filling" argument. Some languages lend themselves better to certain tasks though. As jameshgross points out, it is the science behind the code development that is more important. Without good fundamentals, you can't hope to produce anything more than marginal programs regardless of what language you use.
    Quote Quote  
  29. OK so my memory isn't as good as it used to be.
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  30. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Ok. Here's the question w/ code snips. It's a TWO Question follow-up,
    post.

    First, I'm not sure what this: Ret& is. But, I think that it acts
    as a pointer ?? I've seen some VB code usage as:

    Code:
    ie, 1 - DIM Ret&
    Code:
    ie, 2 - ret& = modMAPI.MAPILogoff(MAPISess, 0, 0, 0)
    Code:
    ie, 3 -  Dim ret As Long
                   If Not ret = MAPI_E_NO_MESSAGES Then
                     AnzahlNachrichten = AnzahlNachrichten + 1
                   End If
    Notes..
    Ok. Sometimes, I see it as ret& and other times, as ret, without "&"
    following it. So, I get confused and am not sure how to port to Delphi,
    correctly.


    VB CODE:
    Code:
    Private Declare Function ReadFile Lib "kernel32" ( _
                    ByVal hFile As Long, _
                    ByVal lpBuffer As String, _
                    ByVal nNumberOfBytesToRead As Long, _
                    lpNumberOfBytesRead As Long, _
                    byval lpOverlapped As Any) As Long


    DELPHI PORT:
    Code:
    Function ReadFile( var hFile: longint; var lpBuffer: string; 
                       var nNumberOfBytesToRead: longint;
                       lpNumberOfBytesRead: Longint;
                       var lpOverlapped): longint; cdecl; external 'kernel32.dll'
    Notes..
    I'm not sure I remember exactly: ByVal 's use, and the Delphi equivalent usage.
    Also, there is the: ByVal lpOverlapped as Any. This seems to be a Variant, and
    I think the Delphi equivalent, is Untyped (or, unkown value of any type) but I'm
    not sure. So, I wrote in: var lpOverlapped, as my solution to the assumed,
    VB Variant port to Delphi.

    Please correct me if my Port is setup wrong, thanks guys.

    -vhelp 4081
    Quote Quote  



Similar Threads