hello im stuck please help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
8 posts
Page 1 of 1
hello im new here, but i really need answer for this i hope i will stay on this awesome forum for so long
ok, first i use visual studio 2010, im making app that
you have a textbox and a button called Open List, when you click on it, it will Open the .txt file from the textbox location.
you got me? ok
now the .txt file looks like
so and the ; seperates each setting
now the thing is, "how" can i load this file into a listview, with "Setting, Value" thing, and also
i need to be able to select one of them for example and be able to delete the setting, with a button Delete
please tell me how, i please need this :(
ty
ok, first i use visual studio 2010, im making app that
you have a textbox and a button called Open List, when you click on it, it will Open the .txt file from the textbox location.
you got me? ok
now the .txt file looks like
setting1:true;setting2:false;setting3:true;so its Setting : [true,false] or might be other options like if font it will be font:tahoma or size .. etc
so and the ; seperates each setting
now the thing is, "how" can i load this file into a listview, with "Setting, Value" thing, and also
i need to be able to select one of them for example and be able to delete the setting, with a button Delete
please tell me how, i please need this :(
ty
Well personally I think it would be easier for you to just save and load two different files one called setting and one called values then load these into two listboxes and then you can just use senders to your listview so it looks good but listboxes are easier to work with in my opinion
it will be harder, i mean, when they wanna delete a item, how will the OTher listbox know which item? lol its impossible,
and if this is possible can i get a code please
and if this is possible can i get a code please
thanks
im waiting u muttley if u can tell me the code for list box, i thought it will be better, but it ned to know wich setting is for which value
#Smiley thanks !
im waiting u muttley if u can tell me the code for list box, i thought it will be better, but it ned to know wich setting is for which value
#Smiley thanks !
well I wont tell you the code straight away as its on my laptop at home and im not their right now but ill send it later when I am home
Till then look for Sender.tag you can use the double click event to send a code that would select the same item as the listview and then you would just remove it with a simple listview.itemes.remove (listview.selecteditem)
Till then look for Sender.tag you can use the double click event to send a code that would select the same item as the listview and then you would just remove it with a simple listview.itemes.remove (listview.selecteditem)
Here's code that will work for you without having to change the way your files are set up. ie, you'll still have a single file with data in the following format:
To get this working, you'll first have to make sure your ListView "View" setting is set to "Details", and that you've added to Columns to your Listview. All of this can be edited by clicking on the small arrow that appears in the top right corner of the ListView when you click it in the designer view.
For the purposes of this example, you'll need three buttons, which will each do one thing (load, delete and save).
Code for the first button:
setting1:value;setting2:valueThe code I'll give you will load data into the listview, delete selected listview items and save the resulting data to the file. If you'd like to also edit values, I can help you out with that as well.
To get this working, you'll first have to make sure your ListView "View" setting is set to "Details", and that you've added to Columns to your Listview. All of this can be edited by clicking on the small arrow that appears in the top right corner of the ListView when you click it in the designer view.
For the purposes of this example, you'll need three buttons, which will each do one thing (load, delete and save).
Code for the first button:
Code: Select all
Code for the second button
If ListView1.Items.Count >= 1 Then
For Each item As ListViewItem In ListView1.Items
ListView1.Items.Remove(item)
Next
End If
Dim raw_settings As String = My.Computer.FileSystem.ReadAllText(My.Computer.FileSystem.SpecialDirectories.Desktop & "\settings.txt")
settings = raw_settings.Split(";")
For i = 0 To settings.Length - 1
Dim comp() As String = settings(i).Split(":")
Dim n As New ListViewItem(comp(0))
n.SubItems.Add(comp(1))
n.Tag = i.ToString
ListView1.Items.Add(n)
Next
Code: Select all
Code for the third button:
For Each item As ListViewItem In ListView1.SelectedItems
ListView1.Items.Remove(item)
Next
Code: Select all
And finally, outside of any sub, just under the Class declaration:
Dim write_settings As String = ""
For i = 0 To ListView1.Items.Count - 1
write_settings = write_settings & ListView1.Items(i).Text & ":" & ListView1.Items(i).SubItems(1).Text
If Not i = ListView1.Items.Count - 1 Then write_settings = write_settings & ";"
Next
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Desktop & "\settings.txt", write_settings, False)
Code: Select all
Don't forget to change the directories and filenames to the ones you're actually using cooll;Dim settings() as String
thanks alot comathi
im at my mom house but when i will be back later i will try it and i think i will be able to edit it, i thinks its easy but if u wanna tell me the code i will be happier
BTW, the same question on CodeProject i got a comment saying "i can teach u, for $250 a hour" so i think this site is the best out of all
thanks !!! loove; loove; loove;
im at my mom house but when i will be back later i will try it and i think i will be able to edit it, i thinks its easy but if u wanna tell me the code i will be happier
BTW, the same question on CodeProject i got a comment saying "i can teach u, for $250 a hour" so i think this site is the best out of all

8 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023