Your Own InputBoxIn VB6 you could use the InputBox for inputting text, like so.
CODE
Dim temp7 As String = InputBox("Enter the album name.")
But it has its limitations;-
Cancel returns
"", which maybe a valid input, so making it nigh on impossible to detect the cancel.
Now we are using vb.net let start on step away from using the old vb6 functionality.
It is really simple to create your own.
All you need is
- A Textbox for the input text. (Txt_TextEntry)
- A Label for the prompt text. (Lbl_Prompt)
- A Button for Cancel (But_Cancel)
- A Button for OK (But_Ok)
Here mine

A little bit of code.
CODE
Imports System.Windows.Forms
Public Class InputBox
Protected m_BlankValid As Boolean = True
Protected m_ReturnText As String = ""
Public Overloads Function ShowDialog( _
ByVal TitleText As String, _
ByVal PromptText As String, _
ByVal DefaultText As String, _
ByRef EnteredText As String, _
ByVal BlankValid As Boolean) As System.Windows.Forms.DialogResult
m_BlankValid = BlankValid
Me.Lbl_Prompt.Text = PromptText
Me.Text = TitleText
Me.Txt_TextEntry.Text = DefaultText
Me.ShowDialog()
EnteredText = m_ReturnText
Return Me.DialogResult
End Function
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_TextEntry.TextChanged
If Me.Txt_TextEntry.Text = "" Then
Me.But_Ok.Enabled = m_BlankValid
Else
Me.But_Ok.Enabled = True
End If
End Sub
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_Ok.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
m_ReturnText = Me.Txt_TextEntry.Text
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_Cancel.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
m_ReturnText = ""
Me.Close()
End Sub
End Class
Usage is not a simple as vb6 but hey we got a lot more capabilities.
CODE
Dim TextReturned As String=""
Dim a As New InputBox
If a.ShowDialog("The Title", "The Prompt", "Default", TextReturned , False) = Windows.Forms.DialogResult.Cancel Then
' Cancel Pressed
Beep()
Else
'
Endif
You can create different types of inputbox, for example;- password, numbers only, masked etc.
Simples
So now you're a custom InputBox building coding pirate.
