Hello,
I have a question about using the StreamWriter function in VB 2010.
Is it possible to filter the results of a list box by their first letter (i.e - in my case the first letter of separate countries) when exporting to a .txt file using the Streamwriter function? I am using a combo box as a drop down list to select the letter to filter out. Basically, I need to figure out how to filter a long list of Countries based on the letter selected by the user then export it using streamwriter. Here is my code so far, however this doesn't filter any results, just writes them all in the .txt file, what can i do to make the code get filtered by first letter obtained from a drop down list box?
I have a question about using the StreamWriter function in VB 2010.
Is it possible to filter the results of a list box by their first letter (i.e - in my case the first letter of separate countries) when exporting to a .txt file using the Streamwriter function? I am using a combo box as a drop down list to select the letter to filter out. Basically, I need to figure out how to filter a long list of Countries based on the letter selected by the user then export it using streamwriter. Here is my code so far, however this doesn't filter any results, just writes them all in the .txt file, what can i do to make the code get filtered by first letter obtained from a drop down list box?
Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click fbdExport.ShowDialog() Dim swrExportStream As StreamWriter = New StreamWriter(fbdExport.SelectedPath) Dim intCDCLocations As Integer intCDCLocations = lstCDCLocations.Items.Count - 1 For intIndex As Integer = 0 To intCDCLocations swrExportStream.WriteLine(lstCDCLocations.Items(intIndex)) Next intIndex swrExportStream.Close() End Sub