I am getting an error that says the function doesn't return a value on all code paths, i am not exactly sure where the error is being cause, thanks for the help. The errors comes from the empName function. Thanks in advance
Public Class Form1
Dim Reader As System.IO.StreamReader
Dim line As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Reader = New System.IO.StreamReader("Program 3 Data.txt")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'selecting the item from the ComboBox with selected item property
Dim emp1 As String
emp1 = ComboBox1.SelectedItem
TextBox1.Text = emp1
RichTextBox1.Text = empName(emp1)
Me.RichTextBox1.Clear()
End Sub
Private Function empName(ByVal employee As String) As String
line = Reader.ReadLine()
While Reader.EndOfStream = False
If InStr(line, employee) Then ' <> 0 Then
empName = employee + line + vbLf
End If
End While
End Function
End Class