Login Register


[save] Need some help saving listbox without showing save dialog [VB.NET] filter_list
Author
Message
RE: Need some help with something [VB.NET] #11
Code:
If TextBox1.Text.Contains("chrome") And ListBox1.Items.Contains(TextBox1.Text) = True Then Process.Start(TextBox1.Text)

tested and working. hope this works Smile
Pierce the life fibers with your drill.

Reply

RE: Need some help with something [VB.NET] #12
Glad it worked, however take note that this is currently case-sensitive.
For making it case-insensitive, store process names in either Lowercase or Uppercase, then change the line of code accordingly.

Example:

If ListBox1.Items.Contains(TextBox1.Text.ToLower) = True Then Process.Start(TextBox1.Text)
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: Need some help with something [VB.NET] #13
i understand its not an IRC but the thing is, HC is missing an IRC like some other Hack forums.

-----------------------------------------------------------------------------------------------------------

@the thread starter
is your problem solved yet?
if no ask any questions.
(This post was last modified: 01-19-2011, 08:35 PM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #14
@threadstarter

You can use this:
Code:
TextBox1.Multiline = True TextBox1.Visible = False TextBox1.Text = ListBox1.Items.Item(1) Dim ftr As New FileStream("C:\listbox.txt", FileMode.Create, FileAccess.Write) Dim stw As New StreamWriter(ftr) stw.BaseStream.Seek(0, SeekOrigin.End) stw.Write(TextBox1.Text) stw.Close()

but sadly... it will write only the first line... you can wait for coder till tomorrow anyways.
sage or anyone else, if you know how to make ListBox1.Items.Item(0 to 10000000000000) in coding i think his problem is solved...
PS: i already tried
"For intadd as integer = 1 to 1000 step 1
ListBox1.Items.Item(intadd)
Next"
but it gives error...
Pierce the life fibers with your drill.

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #15
edit: i tryed editing the codes to suit my befits if anyone is able to help with this then please say.
[Image: 6caf54.gif]

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #16
your welcome but in the end u need to wait for Coder-san for a working code Tongue

also you can post new threads for topics that are not related to eachother just don't spam cause sage just changed his mood from "Web Veteran" to "I'm Watching You" *Gulp*

btw... sadly you can't get the whole listbox with simple codes. if you try listbox1.items.tostring you will see a text saying "{Collection}" instead of the item's text. and if listbox1.items.item(1) you can only select 1 item like (1) means Item Number 1.
Pierce the life fibers with your drill.

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #17
Or this:

Code:
Dim theOutput As String = String.Empty For Each item In ListBox1.Items theOutput &= item & vbCrLf Next IO.File.WriteAllText("C:\new.txt", theOutput)

But Sage's way is faster. Because it does not concatenate strings.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #18
hey i asked about this a while ago and the sage and coder sam both gave me codes to save without showing the showfiledialog but the problem with them both is they do not save the text within the listbox they just create the specified text file can you guys help me so it saves the text within the listbox into the text file
[Image: 6caf54.gif]

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #19
what you mean they still don't work? sage's code works and i tested it Smile

Code:
Dim i As Integer = 0 Dim fs As New FileStream("C:\lstboxsave.txt", FileMode.Create, FileAccess.Write) Dim s As New StreamWriter(fs) s.BaseStream.Seek(0, SeekOrigin.End) While i < ListBox1.Items.Count s.WriteLine(ListBox1.Items(i).ToString()) i = i + 1 End While s.Close()

nice coding sage :thumbs:
Pierce the life fibers with your drill.

Reply

RE: [save] Need some help saving listbox without showing save dialog [VB.NET] #20
Yes, I use the code I posted + file search to add the Contents part in my threads.
[Image: rytwG00.png]
Redcat Revolution!

Reply







Users browsing this thread: