Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Private Sub Command1_Click() Dim s As String: s = InputBox("Please give me something") If StrPtr(s) <> 0 Then Command1.Caption = s Else MsgBox "The action was canceled by the user" End If End Sub Public Sub Command2_Click() Dim s As String: s = InputBox("Please give me something", , "everything") If StrPtr(s) <> 0 Then Command2.Caption = s Else MsgBox "The action was canceled by the user" End If End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Public Function InputBox(Prompt As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt) End Function Public Function InputBox(Prompt As String, Title As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt) End Function Public Function InputBox(Prompt As String, Title As String, Default As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt, Default) End Function |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Public Sub Command1_Click() Dim s As String = InputBox("Please give me something") If s <> Nothing Then Command1.Caption = s Else MsgBox "The action was canceled by the user" End If End Sub Public Sub Command2_Click() Dim s As String = InputBox("Please give me something", "", "everything") If s <> Nothing Then Command2.Caption = s Else MsgBox "The action was canceled by the user" End If End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Public Function InputBox(Prompt As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt) End Function Public Function InputBox(Prompt As String, Default As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt, Default) End Function Public Function InputBox(Prompt As String, Title As String, Default As String) As String Dim Obj() As Object Try: On Error Goto Catch InputBox = javax#swing#JOptionPane.showInputDialog( _ Null, Prompt, Title, JOptionPane.QUESTION_MESSAGE, Null, Obj, Default) Exit Function Catch: InputBox = Nothing End Function |
Administrator
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
This function should be moved to the framework. I would like to publish svn-access for the framework. But I'm not sure how to guarantee the quality for future changes...Quoted
@Manuel: if you think this suits better into Tipps&Tricks you could move this thread if it is possible, OK? thanks
Quoted
But I'm not sure how to guarantee the quality for future changes...
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Private Sub Command1_Click() Dim RetVal As Variant Dim Title As String Dim Prompt As String Dim Default As Variant Title = "Please tell me your name!" Prompt = "Just write your name down here:" Default = 123456789 RetVal = InputBox(Prompt): MessRetVal RetVal RetVal = InputBox(Prompt, Title): MessRetVal RetVal RetVal = InputBox(Prompt, , Default): MessRetVal RetVal RetVal = InputBox(Prompt, "", Default): MessRetVal RetVal RetVal = InputBox(Prompt, Title, Default): MessRetVal RetVal End Sub Private Sub MessRetVal(RetVal As Variant) If RetVal <> "" Then Dim Mess As String If IsNumeric(RetVal) Then Mess = "Ah what, you are just a number?" & vbCrLf Else Mess = "Your Name is: " & vbCrLf End If MsgBox Mess & RetVal End If End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Private Sub Command1_Click() Dim RetVal As Variant Dim Title As String Dim Prompt As String Dim Default As Variant Title = "Please tell me your name!" Prompt = "Just write your name down here:" Default = 123456789 RetVal = InputBox(Prompt): MessRetVal(RetVal) RetVal = InputBox(Prompt, Title): MessRetVal(RetVal) retval = InputBox(Prompt, Default): MessRetVal(RetVal) retval = InputBox(Prompt, "",Default): MessRetVal(RetVal) retval = InputBox(Prompt, Title, Default): MessRetVal(RetVal) End Sub Private Sub MessRetVal(RetVal As Variant) If RetVal <> "" Then Dim Mess As String If IsNumeric(RetVal) Then Mess = "Ah what, you are just a number?" & vbCrLf Else Mess = "Your Name is: " & vbCrLf End If MsgBox Mess & RetVal End If End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Public Function InputBox(Prompt As String) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt) End Function Public Function InputBox(Prompt As String, Title As String) As String InputBox = javax#swing#JOptionPane.showInputDialog( _ Null, Prompt, Title, JOptionPane.QUESTION_MESSAGE) End Function Public Function InputBox(Prompt As String, Default As Variant) As String InputBox = javax#swing#JOptionPane.showInputDialog(Prompt, Default) End Function Public Function InputBox(Prompt As String, Title As String, Default As Variant) As String Dim Obj() As Object Try: On Error Goto Catch InputBox = javax#swing#JOptionPane.showInputDialog( _ Null, Prompt, Title, JOptionPane.QUESTION_MESSAGE, Null, Obj, Default) Exit Function Catch: InputBox = Nothing End Function |