Where the data is stored, is not given in the question
If the data is in a
DataTable
and the format of
ID, Date, msg
etc. is string then the following code can be used to do the task mentioned in the question
Public Function GetMessage(ByVal FilterDate as String, ByVal FilterID as String) as String
Dim FilteredRows as DataRow()
FilteredRows = MessageTable.Select("Date='" & FilterDate & "' and ID='" & FilterID & "'")
If FilteredRows.Length > 0 then
Return FilteredRows(0).Item("Message")
Else
Return ""
End if
End Function
TextBox1.Text = GetMessage("01/01/2012","10004")
TextBox2.Text = GetMessage("01/01/2012","10002")
TextBox3.Text = GetMessage("01/01/2012","10005")