0

I am trying to incorporate many user inputs (textboxes, comboboxes, DatePicker, etc) into one messagebox that will appear once a button is clicked, but I do not know how to do that all within one messagebox. I only know how to do them separately.

Here is my Button_Click code

Dim s, sOut As String
    Dim x As System.Xml.XmlElement = cbEval.SelectedItem

    If x Is Nothing Then
        MsgBox("fill in Evaluator")
    Else
        s = "Evaluator Name: {0}"
        sOut = String.Format(s, x.InnerText)
        MsgBox(sOut)


    End If

When the user chooses an option from cbEval (combobox) and then clicks the "submit" button, the option they chose is displayed. I am trying to also add DatePicker, CbEval, cbSelfEval, txtSelfComments, cbPeer, txtTotal and txtComments to the same MessageBox but don't know how to add them, especially the DatePicker (calendar). Any thoughts as to how I can add more onto 1 messagebox?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Shiro
  • 5
  • 1
  • 5

2 Answers2

0

*emphasized text*maybe this

    Dim s, sOut As String
    Dim x As System.Xml.XmlElement = cbEval.SelectedItem

    If x Is Nothing _
      Or String.IsNullOrEmpty(txtSelfComments.Text) _
      Or DatePicker.SelectedDate Is Nothing _
    Then
        MsgBox("fill in Evaluator")
    Else

        sOut = String.Format("Evaluator Name: {1}{0}Text2: {2}{0}" +
               "Date3: {3}", Environment.NewLine, x.InnerText, txtSelfComments.Text, DatePicker.SelectedDate.ToString())
        MsgBox(sOut)
    End If

for datePicker.SelectedDate.ToString() you can use DateTime Format http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx

m4a
  • 187
  • 1
  • 11
0

Try something like this:

If x Is Nothing _
OrElse String.IsNullOrEmpty(txtTotal.Text) _
OrElse String.IsNullOrEmpty(CbEval.SelectedText) _
OrElse DatePicker.Value Is Nothing Then
    MessageBox.Show("fill in Evaluator");
Else
    sOut = String.Format("Evaluator Name: {0}" & Environment.NewLine() & _
           "Text: {1}" & Environment.NewLine() & _
           "CbValue: {2}" & Environment.NewLine() & _
           "Date3: {3}", _
           x.InnerText, txtTotal.Text, cbEval.SelectedText, DatePicker.Value.ToShortDateString())
    MessageBox.Show(sOut);
End If

When you compare your DatePicker.Value, Nothing will be the min possible date: 01/01/1900.

SysDragon
  • 9,692
  • 15
  • 60
  • 89