1.偶是菜鳥,剛接獲VB,請大家指教.2.程序如下:   
Private Sub Form_Load()
Dim username As String
username = InputBox("Input your name,Please")
Dim usernames(3) As String
    usernames(0) = "xiaow"
    usernames(1) = "xiaol"
    usernames(2) = "xioaz"
    usernames(3) = "xiaoh"
Dim i As Integer
Dim f As Boolean
f = False
For i = 0 To 3
    If username = usernames(i) Then
       f = True
    End If
Next i
If f = False Then
   MsgBox "This is not name,exit system"
   End
   
End IfEnd SubPrivate Sub Picture1_Paint()
Picture1.Print "you are welcome:" + usernameEnd Sub
3.用戶名為xiaow,如何輸出:you are welcome:xiaow4.請各位指教!呵呵...

解决方案 »

  1.   

    Private Sub Form_Load()
    Dim username As String
    username = InputBox("Input your name,Please")
    Dim usernames(3) As String
        usernames(0) = "xiaow"
        usernames(1) = "xiaol"
        usernames(2) = "xioaz"
        usernames(3) = "xiaoh"
    Dim i As Integer
    Dim f As Boolean
    f = False
    For i = 0 To 3
        If username = usernames(i) Then
           f = True
           msgbox "you are welcome: " & username  '''''''''''''''    End If
    Next i
    If f = False Then
       MsgBox "This is not name,exit system"
       End
       
    End IfEnd SubPrivate Sub Picture1_Paint()
    Picture1.Print "you are welcome:" + usernameEnd Sub
      

  2.   

    public NameNumber as integer
    ----------------------------
    NameNumber=0
    For i = 0 To 3
        If username = usernames(i) Then
            NameNumber=i
           f = True
        End If
    Next i
    ...
    Picture1.Print "you are welcome:" + username(NameNumber)
      

  3.   

    TO:GGL123 偶要求在Picture1中輸出,呵呵...TO: guoxu_009  能否直接在偶的語句中修改!呵呵...
      

  4.   

    偶要求在Picture1中輸出,呵呵.
    //
    那就改成这句了:
    Picture1.Print "you are welcome:" + username(NameNumber)
      

  5.   

    Picture1.Print "you are welcome:" + username(NameNumber)應該改為:username====usernames(NameNumber)
    可電腦提示還是錯誤!呵呵...
      

  6.   

    偶要求在Picture1中輸出,呵呵.
    //
    msgbox "you are welcome: " & username  '''''''''''''''
    那就改成这句了:
    Picture1.Print "you are welcome:" & username  
      

  7.   

    可仍沒有用戶名出現!呵呵...Picture1.Print "you are welcome:" & username
      

  8.   

    Private Sub Form_Load()
    Dim username As String
    username = InputBox("Input your name,Please")
    Dim usernames(3) As String
        usernames(0) = "xiaow"
        usernames(1) = "xiaol"
        usernames(2) = "xioaz"
        usernames(3) = "xiaoh"
    Dim i As Integer
    Dim f As Boolean
    f = False
    For i = 0 To 3
        If username = usernames(i) Then
           f = True
           'msgbox "you are welcome: " & username  '''''''''''''''
            
             Picture1.Print "you are welcome:" & username   '那就改成这句了:    End If
    Next i
    If f = False Then
       MsgBox "This is not name,exit system"
       End
       
    End IfEnd Sub
      

  9.   

    If f = False Then
       MsgBox "This is not name,exit system"
       End------------------------------------------
    If f = False Then
       MsgBox "This is not name,exit system"
       else
       msgbox"Welcome xxx!"
    End if
      

  10.   

    仍不行!最好你先調試一下,再告訴偶!呵呵..Picture1.Print "you are welcome:" & username   '那就改成这句了:
      

  11.   

    picture的Appearance,背景改为白色。
    用的是
    GGL123() 信誉:100  2004-11-06 11:43:00  
    的代码通过。
      

  12.   

    在picture1中入一Label,将那句换成这句:
     Label1.Caption = "you are welcome:" & username
      

  13.   

    整個Picture畫面全部是白色!呵呵...
    picture的Appearance,背景改为白色。
    用的是
    GGL123() 信誉:100  2004-11-06 11:43:00  
    的代码通过
    仍不行!最好你先調試一下,再告訴偶!呵呵..在picture1中入一Label,将那句换成这句:
     Label1.Caption = "you are welcome:" & username
      

  14.   

    jimmyge(做人要厚道---葛優) 干嘛给我发4个短消息,ft
    居然到VB装菜鸟,大家听着, jimmyge(做人要厚道---葛優) 是windows的斑竹哈,不许他装菜鸟:D:D:D:D:D
      

  15.   

    Option ExplicitDim UserName As StringPrivate Sub Form_Load()
      '  Dim username As String
        UserName = InputBox("Input your name,Please")
    '    Dim usernames(3) As String
    '        usernames(0) = "xiaow"
    '        usernames(1) = "xiaol"
    '        usernames(2) = "xioaz"
    '        usernames(3) = "xiaoh"
    '    Dim i As Integer
    '    Dim f As Boolean
    '    f = False
    '    For i = 0 To 3
    '        If username = usernames(i) Then
    '           f = True
    '        End If
    '    Next i
    '    If f = False Then
    '       MsgBox "This is not name,exit system"
    '       End
    '
    '    End If
    End SubPrivate Sub Picture1_Paint()
        Picture1.Print "you are welcome:" + UserName
    End Sub这样吗?我没看题目啊,jimmyge(做人要厚道---葛優) 直接MSN上跟偶手啊,偶的IE有问题,55555
      

  16.   

    把Dim username As String方到Form_Load事件外面
      

  17.   

    把picture删除,再新建一个,把 Appearance 改成0-flat。
    你的picture有问题,我的运行OK。
      

  18.   

    1.不找你們版主解決,偶還找誰去?呵呵..2.windows是版主,可在vb是個十足的菜鳥,呵呵...jimmyge(做人要厚道---葛優) 干嘛给我发4个短消息,ft
    居然到VB装菜鸟,大家听着, jimmyge(做人要厚道---葛優) 是windows的斑竹哈,不许他装菜鸟:D:D:D:D:D
      

  19.   

    没事哈,偶以前也是繁体啊,偶看得懂你的话。不过现在windows的问题,偶直接找icuc88,ft,没给我解决几个,都我自己解决的。
      

  20.   

    告訴偶你的MSN?偶的是[email protected]这样吗?我没看题目啊,jimmyge(做人要厚道---葛優) 直接MSN上跟偶手啊,偶的IE有问题,55555
      

  21.   

    DEAR ALL  1.問題仍沒有得到解決?  2.會不會是偶安裝了精簡版VB 6.0的原因?請各位指點,呵呵...
      

  22.   

    呵呵 不会吧,把Dim UserName As String提到最前面也没解决?这次我可是试过了,呵呵 你搞什么啊?
      

  23.   

    把Dim UserName As String提到最前面就可以了如果还有问题,你跟踪看一下
      

  24.   

    1.仍不行,圖個方便裝個精簡版的,現在看來大錯特錯!2.偶將各位給偶之代碼覆制上去調試,仍不輸出you are welcome:xiaow3.嗨!還是要換個600m的VB,這個VB才5.8M有點愚弄人.呵呵...
      

  25.   

    在有问题的语句上,右键-〉切换->断点然后运行,就可以跟踪了
    如果还不行,加模块
    定义
    Public UserName As String
      

  26.   

    1.真的要好好謝謝你!----online(龙卷风V3.0--笑傲江湖).2.但語句執行並沒有什麼問題!呵呵...3.Public UserName As String還是不行!4.偶看等偶把vb 600m裝完後再調試報告各位!呵呵...
      

  27.   


    呵呵 5.8M的vb网上有没有下的呀,帮忙找个来玩玩呀
      

  28.   

    哎,不要说了,根本就是他用那什么6M的VB导致的,搞笑
      

  29.   

    1.將VB精簡版卸了!呵呵..2.將以下電腦在偶的電腦調試可以輸出:you are welcome:xiaow3.但輸入任何字符都可以輸出,又缺少了判斷!呵呵...
    Option ExplicitDim UserName As StringPrivate Sub Form_Load()
      '  Dim username As String
        UserName = InputBox("Input your name,Please")
    '    Dim usernames(3) As String
    '        usernames(0) = "xiaow"
    '        usernames(1) = "xiaol"
    '        usernames(2) = "xioaz"
    '        usernames(3) = "xiaoh"
    '    Dim i As Integer
    '    Dim f As Boolean
    '    f = False
    '    For i = 0 To 3
    '        If username = usernames(i) Then
    '           f = True
    '        End If
    '    Next i
    '    If f = False Then
    '       MsgBox "This is not name,exit system"
    '       End
    '
    '    End If
    End SubPrivate Sub Picture1_Paint()
        Picture1.Print "you are welcome:" + UserName
    End Sub
      

  30.   

    可偶將偶的代碼可以判斷,但還是不能輸出,各位幫偶看看:Option ExplicitDim UserName As StringPrivate Sub Form_Load()
    Dim UserName As String
    UserName = InputBox("Input your name,Please")
    Dim usernames(3) As String
        usernames(0) = "xiaow"
        usernames(1) = "xiaol"
        usernames(2) = "xioaz"
        usernames(3) = "xiaoh"
    Dim i As Integer
    Dim f As Boolean
    f = False
    For i = 0 To 3
        If UserName = usernames(i) Then
           f = True
           
        End If
    Next i
    If f = False Then
       MsgBox "This is not name,exit system"
       End
       
    End IfEnd SubPrivate Sub Picture1_Paint()Picture1.Print "you are welcome:" & UserNameEnd Sub
      

  31.   

    你看它定义2个username就知道了不想帮他做,就是因为他到处发消息,所以特不想做了
      

  32.   

    '提高变量的作用范围
    Dim username As StringPrivate Sub Form_Load()
    username = InputBox("Input your name,Please")
    Dim usernames(3) As String
        usernames(0) = "xiaow"
        usernames(1) = "xiaol"
        usernames(2) = "xioaz"
        usernames(3) = "xiaoh"
    Dim i As Integer
    Dim f As Boolean
    f = False
    For i = 0 To 3
        If username = usernames(i) Then
           f = True
        End If
    Next i
    If f = False Then
       MsgBox "This is not name,exit system"
       End
    End IfEnd SubPrivate Sub Picture1_Paint()
    Picture1.Print "you are welcome:" + usernameEnd Sub
      

  33.   

    *^_^*你到底搞定没??这么多VB大版回答,我就不说什么了,偶还没见过6M的VB呢*^_^*
      

  34.   

    '呵呵 老大 半夜了偶不在 这样改偶试过了。
    Option ExplicitDim UserName As StringPrivate Sub Form_Load()
    'Dim UserName As String
    UserName = InputBox("Input your name,Please")
    Dim usernames(3) As String
        usernames(0) = "xiaow"
        usernames(1) = "xiaol"
        usernames(2) = "xioaz"
        usernames(3) = "xiaoh"
    Dim i As Integer
    Dim f As Boolean
    f = False
    For i = 0 To 3
        If UserName = usernames(i) Then
           f = True
           
        End If
    Next i
    If f = False Then
       MsgBox "This is not name,exit system"
       End
       
    End IfEnd SubPrivate Sub Picture1_Paint()Picture1.Print "you are welcome:" & UserNameEnd Sub
      

  35.   

    1.衷心的感謝各位.呵呵..2.問題終於解決了!呵呵...3.請大家到http://community.csdn.net/Expert/topic/3528/3528879.xml?temp=.5979425 
    接分!呵呵...