![]() |
|
[.NET] Saving to .txt giving me issues?? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Saving to .txt giving me issues?? (/showthread.php?tid=5557430) |
Saving to .txt giving me issues?? - Gørilla - Feb 21, 2017 I keep getting this error whenever I am saving my listbox info to a .txt file for some reason.. Could anyone help me out? I've been screwin with it for a couple hours now. https://gyazo.com/df41710a0ab0d21a08d06cf3dbcfbe84 Code for the saving button: Code Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickAm I missing something here..? It's never given me this problem in any other programs I've used it in. * - +Haze - Feb 21, 2017 ListBox1 is probably null, that's the issue * - Gørilla - Feb 21, 2017 (Feb 21, 2017 05:50 PM)+Haze Wrote: ListBox1 is probably null, that's the issue How could it be null? The saving option works fine when there's nothing in the tlist box. But once I have stuff in the list box it will not save.. It saves like 50% of it then gives an error, which I cannot find what that error is.) * - Darrell - Feb 21, 2017 Will take a look at this soon for you. * - Gørilla - Feb 21, 2017 (Feb 21, 2017 05:56 PM)apt-get Wrote: Will take a look at this soon for you. Sounds good. I'm not trying to be spoon fed, but I've been messing with it for about 4 hours now and no matter how I put it, I get the same error. I'm assuming I'm getting something in my list box that is not being able to be saved. Would anyone know how to only allow certain things in a list box? * - redmoon90211 - Feb 21, 2017 you have a null string or object in the listbox * - Gørilla - Feb 21, 2017 (Feb 21, 2017 05:59 PM)redmoon90211 Wrote: you have a null string or object in the listbox I am now trying to figure out how to remove only things that are not numbers or the ":" sign. * - Gt403cyl - Feb 21, 2017 I'm not sure how to do it in .vb But a try/catch in the save button with Code tryThis can be simplified without the try/catch but meh you get the idea. Just it's in c# so convert it as needed. * - redmoon90211 - Feb 21, 2017 (Feb 21, 2017 06:00 PM)Gørilla Wrote: I am now trying to figure out how to remove only things that are not numbers or the ":" sign. Code For Each item In ListBox1.Items* - Gørilla - Feb 21, 2017 (Feb 21, 2017 06:08 PM)redmoon90211 Wrote:Seem to get an error when I try to use this. It's because of the if statement. (Feb 21, 2017 06:08 PM)Gt403cyl Wrote: I'm not sure how to do it in .vb I'll see if I can convert this:) * - Gt403cyl - Feb 21, 2017 There maybe errors (disclaimer lol on phone) but the you get the idea.. I didn't see you were using a listbox but should still work just replace as needed. * - Gørilla - Feb 21, 2017 (Feb 21, 2017 06:18 PM)Gt403cyl Wrote: There maybe errors (disclaimer lol on phone) but the you get the idea.. I'm trying to convert it but I want to keep numbers 0-9 in, periods, and semi colens and everything else is to be deleted. Currently trying to use this on my start thread button: Code Dim i As Integer = 0Turns out I had my regex off a tad, and for some reason when using both threads at the same time it returns as null value, assuming it's conjoining some information some how. But spaced them out with a timer and fixed the problem.. It only took me 6 hours but damn it was worth the learning curve. Thanks for all the help guys. |