The actual overwrite is easy: The
File class[
^] alone contains several methods that will do it, never mind the
FileStream class[
^]:
File.WriteAllBytes(String, Byte[]) Method (System.IO) | Microsoft Docs[
^]
File.WriteAllLines Method (System.IO) | Microsoft Docs[
^]
File.WriteAllText Method (System.IO) | Microsoft Docs[
^]
Are the main ones.
So the problem is collecting the data - and that isn't difficult either, but exactly how to do it will depend on your DGV and how you loaded it with data, plus what you actually want in the file. And we have no idea on either of those.
If you added rows manually, the loop through all rows and combine each of the URL containing cells into an output (StringBuilder, List, whatever floats your boat).
If you used a DataSource, then look to the data you provided DGV with, and use that. We have no idea what you used, and there are far, far too many possibilities for us to give you anything like a precise answer!
So start with what you want in the file, then look at your data itself. We can;t do that for you!