2013-03-19 3 views
3

코드에서 호출되는 입력 상자가 있지만 모든 양식의 아이콘이있는 동안이 입력란에는 아이콘이 표시되지 않습니다. 그것은 메시지 박스를위한 표준 옵션이기 때문에, 입력 박스에 관한 표준 옵션이 없다는 것이 이상하다고 생각합니다.vb.net에서 입력 상자 아이콘을 변경할 수 있습니까?

기본적으로이 입력란에 아이콘을 표시하려면 어떻게해야합니까?

inventory = InputBox("Inventory:" & vbCrLf & "Make sure this is correct, as an error can cause failure to login.", "Edit Inventory", oldinv)

참고 :이 순수하게 미학적 문제가이 시점에서 할 더 중요한 일이 있기 때문에, 난 정말이 많이 연구하지 않았습니다.

+4

남 자신의 InputBox. vb와 함께 오는 것은 빤다. – Jaxedin

답변

2

당신은 내 자신에서 InputBox

입력 양식

Public Class frmInputbox 

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click 
    btnResponse.Text = MsgBoxResult.Ok 
    Me.Hide() 
    End Sub 

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click 
    btnResponse.Text = MsgBoxResult.Cancel 
    Me.Hide() 
    End Sub 

End Class 

래퍼

Public Class DrZedInputbox 

    Private Shared _UserResponseDlg As New frmInputbox() 

    Public Shared Function Inputbox(Prompt As String, Title As String, ByRef TextData As String, Left As Integer, Top As Integer, Icon As System.Drawing.Icon) As MsgBoxResult 
    Inputbox = MsgBoxResult.Cancel 
    _UserResponseDlg.Text = Title 
    _UserResponseDlg.Label1.Text = Prompt 
    _UserResponseDlg.TextBox1.Text = textData 
    _UserResponseDlg.Left = Left 
    _UserResponseDlg.Top = Top 
    _UserResponseDlg.Icon = Icon 
    _UserResponseDlg.ShowDialog() 
    Inputbox = _UserResponseDlg.btnResponse.Text 
    End Function 

    Public Shared ReadOnly Property TextData As String 
    Get 
     Return _UserResponseDlg.TextBox1.Text 
    End Get 
    End Property 

    Public Shared ReadOnly Property Response As MsgBoxResult 
    Get 
     Return CType(_UserResponseDlg.btnResponse.Text, MsgBoxResult) 
    End Get 
    End Property 

    Public Sub Dispose() 
    _UserResponseDlg = Nothing 
    End Sub 

    Protected Overrides Sub Finalize() 
    _UserResponseDlg = Nothing 
    MyBase.Finalize() 
    End Sub 

End Class 

구현을 시도 할 수 있습니다

에서 InputBox

을 표시하려면

67,는

DrZedInputbox.Dispose() 

UPDATE (정돈)가에서 InputBox 마무리

MsgBox("Text data entered: " & DrZedInputbox.TextData) 
MsgBox("User response: " & DrZedInputbox.Response) 

(a MSGBOX을 이용하여 도시)

라이트 사진 결과를 수집

DrZed.Inputbox sample

+0

참고 사항 : 취소 버튼 아래에는 btnResponse라는 다른 보이지 않는 버튼이 있는데, 여기에는 결과가 저장되어 있습니다. – Zeddy

1

기본 대화 상자를 구현해야하는 것처럼 보입니다 (기본적으로 지원되지 않음). 참조 : 구글에

그리고 다른 결과를 비슷한 조언과 함께.

관련 문제