Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27333

VS 2010 DataGridView - Code modification

$
0
0
Hi All,

I have the code below, which I was using with a CheckedListBox. I've now the need to use a DataGridView instead to display the data. The code was set to find the selected data in the CheckedListBox and then basically delete the line from in.txt so it didn't show the item anymore.

Code:


'Write/Read all the in.txt find checked value and replace line with vbNewline and nothing
        'Basically deletes the line! Important so it doesn't leave a checkbox with no value
        Dim TheFile As String = "c:\in.txt"
        File.WriteAllText(TheFile, File.ReadAllText(TheFile).Replace(CheckedListBox1.SelectedItem & vbNewLine, ""))

How can I modify this, so when I have selected a row from the DataGridView, it removes the line from the text file?

Viewing all articles
Browse latest Browse all 27333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>