codeorder 197 Nearly a Posting Virtuoso

"Code not working"?
.you making fun of me? :D

Since I recently posted to your other thread, hope it clarifies this one.:)
http://www.daniweb.com/software-development/vbnet/threads/408271/1743532#post1743532

codeorder 197 Nearly a Posting Virtuoso

Had a chance to play w/this for a few minutes, though I could Not test.

Public Class Form1
    Private isSendingPMSxD As Boolean = False '// alert wb that it is a p.m. page.
    Private iStartID, iEndID As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.ScriptErrorsSuppressed = True '// disable Error.Messages.
    End Sub

    Private Sub showCoolMessage(ByVal selCoolMessage As String, ByVal selCoolTitle As String) '// just.because.
        MessageBox.Show("Please enter " & selCoolMessage, selCoolTitle & " Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Sub

    Private Sub _Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        With TextBox3 : If .Text = "" Then : showCoolMessage("a subject", "Subject") : Exit Sub : End If : End With
        With TextBox4 : If .Text = "" Then : showCoolMessage("a message", "Message") : Exit Sub : End If : End With
        With TextBox5
            If .Text = "" OrElse Not IsNumeric(CInt(.Text)) Then : showCoolMessage("start ID to PM", "Start ID") : Exit Sub
            Else
                iStartID = CInt(.Text)
            End If
        End With
        With TextBox6
            If TextBox6.Text = "" OrElse Not IsNumeric(CInt(.Text)) Then : showCoolMessage("end ID to PM", "End ID") : Exit Sub
            Else
                iEndID = CInt(.Text)
            End If
            : End With
        isSendingPMSxD = True
        wbNavigate(iStartID)
        Button3.Enabled = False
    End Sub

    Private Sub wbNavigate(ByVal selCoolIDtoUse As Integer)
        WebBrowser1.Navigate("http://forum.ea.com/uk/pm/sendTo/" & selCoolIDtoUse & ".page")
    End Sub

    Private Sub _WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If isSendingPMSxD Then
            With WebBrowser1.Document
                .GetElementById("subject").SetAttribute("value", TextBox3.Text)
                .GetElementById("message").SetAttribute("value", TextBox4.Text)
                .GetElementById("btnSubmit").InvokeMember("click")
                Label4.Text = iStartID
                Application.DoEvents()
                If Not iStartID = iEndID …
codeorder 197 Nearly a Posting Virtuoso

Reverend Jim, I completely agree since I also created an automated p.m.s'er:D to send p.m.s:D to those that did not mark their threads Solved or just abandoned their threads, and it did use the _wb_DocumentCompleted event.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fileName As String = FileUpload1.PostedFile.FileName
        Dim fileServer As String = FileUpload1.FileName

        If FileUpload1.HasFile Then
            ' some code here
            '//////////////////////////////////////////////////
            If isCoolExcelFile(fileName) Then
                '//////////////////////////////////////////////////
                'some code here
            Else
                'some code here
            End If
        Else '// If FileUpload1.Has "NO" File
            'some code here
        End If
    End Sub

    Private Function isCoolExcelFile(ByVal selCoolFile As String) As Boolean
        Select Case IO.Path.GetExtension(selCoolFile)
            Case ".xls"
                Return True
            Case Else
                Return False
        End Select
    End Function
codeorder 197 Nearly a Posting Virtuoso

Just taking a wild guess here; I think that this might be the cause of the issue.

While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
                Application.DoEvents()
            End While

Try commenting out the Application.DoEvents() and report back.

The WebBrowser1.ScriptErrorsSuppressed = True can be set "only once" in Form1_Load and it will take care of all Script.Error Messages andOr can be set in the wb(WebBrowser)'s Properties.

codeorder 197 Nearly a Posting Virtuoso

Pgmer, something else other than glad I could help.
.You can use more than one "something" in a Select Case(line.2).

Select Case fileExtenstion
                Case ".xlt",".xls"
                    Return True                
                Case Else
                    Return False
            End Select

jbutardo, I already flagged your thread as an ASP.NET thread, though I will try to help once you provide more defined details as to exactly "how" to make it more of a "clean code" other than having one too many declarations.

codeorder 197 Nearly a Posting Virtuoso

Pgmer, why Not use IO.Path.GetExtension("full File.Path or just File.Name here") ?

codeorder 197 Nearly a Posting Virtuoso
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With New OpenFileDialog
            .Filter = "Only myCool Excel Files|*.xls;*.xlst"
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                MsgBox("tada")
            End If
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

As previously mentioned, not a db.coder here, thus I'll edit w/no radar(my vb.net):D.

Dim sCoolNewLine As String = "~"
        con.Open()
        cmd = New SqlCommand("INSERT INTO SampleTbl VALUES('" & TextBox1.Text.Replace(vbNewLine, sCoolNewLine) & "'", con)
        cmd.ExecuteNonQuery()
        con.Close()

This TextBox1.Text.Replace(vbNewLine, sCoolNewLine) will replace line.breaks from a TextBox, w/a char("~") and should be done when updating your db(database).

To undo this, when retrieving info from db, reverse the .Replace process to TextBox1.Text.Replace(sCoolNewLine, vbNewLine) and you should get your line.breaks as previously were, in TextBox.

The char ("~") should be blocked from being typed by a user, to not confuse the way your code updates/retrieves data to/from db.

I used a String in my previously posted code, though you can always use just a char as "~" or "^", or even ".etc.". Reason for String; Not likely it will ever be typed by a user as ".:.myCooLvbNewLine.:." , thus no issues.

Hope this helps.:)

codeorder 197 Nearly a Posting Virtuoso

Since I'm Not a db.coder, I do not know of any other way to pursue this other than:

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With TextBox1 : .Text = replaceNewLine(.Text, True) : End With '// replace line.break w/String.
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        With TextBox1 : .Text = replaceNewLine(.Text, False) : End With '// replace String with line.break.
    End Sub

    Private Function replaceNewLine(ByVal selContent As String, ByVal isReplacingNewLineWithChar As Boolean, _
                                    Optional ByVal selNewLineStringToUse As String = ".:.myCooLvbNewLine.:.") As String
        If isReplacingNewLineWithChar Then : Return selContent.Replace(vbNewLine, selNewLineStringToUse)
        Else : Return selContent.Replace(selNewLineStringToUse, vbNewLine)
        End If
    End Function
End Class

Basically, replace each line.break w/a char. or a string that will not be found or likely used in your db.items, save to db and un.replace?:D the line.break string when loading items from the db.

codeorder 197 Nearly a Posting Virtuoso

I am also quite unclear on your question; thus If you would like my further support for this.thread, do supply the neccessary and well defined.details. Otherwise, I will take leave and fly on my own w/out a radar, as always:).

codeorder 197 Nearly a Posting Virtuoso
codeorder 197 Nearly a Posting Virtuoso

See If this helps.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        MsgBox(xDate)
        MsgBox(xDate("dd"))
    End Sub
    Private Function xDate(Optional ByVal selDateFormat As String = "MM.dd.yyyy") As String
        Return Date.Now.ToString(selDateFormat)
    End Function
codeorder 197 Nearly a Posting Virtuoso

2.Buttons,1.ListBox,new.Project

Imports System.IO
Public Class Form1
#Region "-----===-----===-----=== DECLARATIONS ÆND STUFF ===-----===-----===-----"

    Private btnUp, btnDown As Button, lbMain As ListBox '// If you need control, you make your own.
    Private iT, iM As Integer, sT As String '// TEMP sh.t.
#End Region '===-----===-----===-----'

#Region "-----===-----===-----=== START.UP ÆND SH.T===-----===-----===-----"

    Private Sub loadMyCoolApp()
        Me.Font = New Font("verdana", 10, FontStyle.Bold) '// just.because.
        btnUp = Button1 : With btnUp : .Text = "^" : .Cursor = Cursors.Hand : End With '// take control of code.
        btnDown = Button2 : With btnDown : .Text = "v" : .Cursor = Cursors.Hand : End With '// loose control of code. xD
        lbMain = ListBox1 : With lbMain.Items : .Add("Guava") : .Add("Apple") : .Add("Pineapple") '// set.load ListBox.
            If Not .Count = 0 Then lbMain.SelectedIndex = 0 Else toogleUpDown()
        End With
    End Sub
    Private Sub toogleUpDown()
        iT = lbMain.SelectedIndex : btnUp.Enabled = False : btnDown.Enabled = False '// lights.off.
        If Not iT = -1 Then '// if item selected Then lights.on.
            If iT > 0 Then btnUp.Enabled = True
            If iT < lbMain.Items.Count - 1 Then btnDown.Enabled = True
        End If
    End Sub
    Private Sub relocateItems(ByVal selBtn As Button)
        With lbMain
            sT = .SelectedItem '// get.Item Value.
            iM = .SelectedIndex  '// get.Item Index and some.
            .Items.Remove(.SelectedItem) '// .Remove.Item.
            If selBtn Is btnUp Then .Items.Insert(iM - 1, sT) '// .insert.Item. why -1?, cause it worx.xD
            If selBtn Is btnDown Then .Items.Insert(iM + 1, sT) '// .insert.Item. why +1?, cause it worx.xD
            .SelectedItem = sT '// highlight item again.
            Exit …
codeorder 197 Nearly a Posting Virtuoso

>>Got it?
.will try to get it.Then reply.:)

codeorder 197 Nearly a Posting Virtuoso

>>in the above code 34th line i am geting a error like "Index was outside the bounds of the array."
Have you tried the previously posted.code in a New Project w/only 6.Buttons? If Not, give that a Try, should Not error.

codeorder 197 Nearly a Posting Virtuoso

See if this helps to load a file by clicking a Button.

Imports System.IO
Public Class Form1
#Region "-----===-----===-----=== DECLARATIONS ===-----===-----===-----"
    Private myCoolFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myCoolBtnTextFile.txt" '// your.File to .Save/.Load to/from.
    Private chrMain As Char = "|" '// char used to .Split each line into 2, for .Name and for .Tag of each btn.
#End Region '===-----===-----===-----'


    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        LoadOrSaveBtnsOptions(True) '// Save.File.
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        LoadOrSaveBtnsOptions() '// Load.File If available.
    End Sub

#Region "-----===-----===-----=== BTNS OPTIONS ===-----===-----===-----"

    Private Sub LoadOrSaveBtnsOptions(Optional ByVal isSaving As Boolean = False)
        '/////////////////////////////////////////////////    YOUR BUTTONS    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        Dim btnArray() As Button = {Button1, Button2, Button3, Button4, Button5, Button6}
        '/////////////////////////////////////////////////                              \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        Dim sContent As String = "" : Dim arFileLines() As String = Nothing '// read.File if it.Exists.
        If Not isSaving Then If File.Exists(myCoolFile) Then arFileLines = File.ReadAllLines(myCoolFile)
        For i As Integer = 0 To btnArray.Length - 1 '// loop thru each btn in btn.Array.
            With btnArray(i)
                If Not isSaving Then '// check if it should Save of Not.
                    '// add Event.Handlers to each btn.
                    AddHandler .MouseDown, AddressOf _btnsOptions_MouseDown '// allows right click of .
                    AddHandler .Click, AddressOf _btnsOptions_Click '// executes tag.process of .
                    .Cursor = Cursors.Hand '// cute.Hand cursor. xD
                    If Not btnArray.Length = 0 Then '// check If File has been loaded.
                        '// set .Text and .Tag by .Splitting the line into Arrays.
                        .Text = arFileLines(i).Split(chrMain).GetValue(1) : .Tag = arFileLines(i).Split(chrMain).GetValue(2)
                    End If
                    Continue For '// …
codeorder 197 Nearly a Posting Virtuoso

>>Form3 f3=new Form3();
That looks entirely like C#.code and will "ALWAYS" give you an error in VB.NET.

AndAlso, as soon as you declare as "New Form3", you will "ALWAYS" load a new.instance of a Form.

codeorder 197 Nearly a Posting Virtuoso

Not really, though close.

With ListBox1
            If Not .SelectedIndex = -1 Then '// if .item selected.
                Dim L1SI As String = .SelectedItem
                '// run code here for up/down.
                .SelectedItem = L1SI
            End If
        End With
codeorder 197 Nearly a Posting Virtuoso

Thanks for input NewUserVB.Net, though I'll wait for the o.p's(original.poster's) input on this; only makes sense Not to go way out of my way, when I possibly only have to walk a few steps Then be back on my original.path.:)

codeorder 197 Nearly a Posting Virtuoso

I would personally use a File(possibly .txt or .ini) for I personally like having the option to locate my Default WebBrowsers ToolBar links, etc., and be able to view them just by browsing my.p.c..

codeorder 197 Nearly a Posting Virtuoso

What exactly is the issue?
.moving the items up/down?
.or selecting the previously selected.Item with a new Index?

codeorder 197 Nearly a Posting Virtuoso

See if this helps to load Form2 from Form1, into the MDI Form.

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With Form2
            .MdiParent = myCoolMDIform '// set the MDI Parent for the Form.
            .Show() '// Load the Form.
        End With
    End Sub
End Class

AndAlso, this to Not create a new.instance of Form2.

Public Class Form2

    Private Sub Form2_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True '// .Cancel closing the Form.
        Me.Hide() '// ...and .Hide it.:)
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Thanks for the necessary details to get "another" +=1 to my Solved.Threads list.:D

Imports System.IO
Public Class Form1
    Private myCoolFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myCoolBtnTextFile.txt"

    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        With Button2
            If Not .Tag Is Nothing Then File.WriteAllText(myCoolFile, .Text & vbNewLine & .Tag) '// save.File.
        End With
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If File.Exists(myCoolFile) Then
            Dim arCoolT() As String = File.ReadAllLines(myCoolFile) '// read File into Array.
            With Button2
                .Text = arCoolT(0) '// line.1
                .Tag = arCoolT(1) '// line.2
            End With
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With New OpenFileDialog
            .Title = "Select a Cool File to load..."
            ' .Filter = ""
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                Button2.Text = IO.Path.GetFileName(.FileName) '// only FileName and .ext.
                Button2.Tag = .FileName '// FullPath of .File, to load .File from.
            End If
        End With
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        With Button2
            If Not .Tag Is Nothing Then Process.Start(.Tag)
        End With
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Then a Button.Click shall be.:)

Public Class Form1
  
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        MsgBox("rtb is accurate = " & validateCoolRTB(RichTextBox1, 7))
    End Sub
    Private Function validateCoolRTB(ByVal selCoolRTB As RichTextBox, ByVal iIDlengthThatIsAlsoCooLxD As Integer) As Boolean
        For Each itm As String In selCoolRTB.Lines '// loop thru lines.
            If Not itm.Length = iIDlengthThatIsAlsoCooLxD Then Return False '// get.lenght of line and If Not accurate, Return False.
        Next
        Return True '// If all checks out OK, Then Return True.:)
    End Function
End Class
codeorder 197 Nearly a Posting Virtuoso

How do you plan to:>>check if a line in the RTB = 7
.Button.Click?, rtb.Click?, waving your hand?

codeorder 197 Nearly a Posting Virtuoso

>>just tell me how to save in this button please refer the below code
Can you explain a little more in.depth?; as to If you would like a SaveFileDialog to save the File or save the Button it's self to a File?

codeorder 197 Nearly a Posting Virtuoso
YourCoolLabelToDisplayScoreInt.Text = ScoreInt.ToString

...should be added somewhere w/in your Private Sub ButtonGuessAnswer_Click Sub, possibly the very last line of code.

codeorder 197 Nearly a Posting Virtuoso

Something simple, use a .txt File. This saves the File to Desktop.

Imports System.IO
Public Class Form1
    Private myCoolFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myCoolBtnTextFile.txt"

    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        File.WriteAllText(myCoolFile, Button1.Text)
    End Sub
 
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If File.Exists(myCoolFile) Then Button1.Text = File.ReadAllText(myCoolFile)
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        With ListBox1
            If Not .SelectedIndex = -1 Then Button1.Text = .SelectedItem Else Button1.Text = ""
        End With
    End Sub
End Class
NewUserVB.Net commented: he his the best +1
codeorder 197 Nearly a Posting Virtuoso

Try Repairing/Reinstalling Visual Studios. Could be an internal issue w/VS, although...
If this only happens in one project, cloning/restarting the project might and possibly will fix the issue.

I personally would Reinstall(after saving my.Cool VS.Settings, If you got any), to get a new copy of VS. Hope this helps.

codeorder 197 Nearly a Posting Virtuoso

Question 1, check line.25.
If you want to keep score up to date and Not constantly resetting it's self to "0" before it adds a +1 to it, .Remove the line. Hope this helps.

Almost missed this. :D
Line.59, same issue. .Remove it and your score should update as needed.

codeorder 197 Nearly a Posting Virtuoso

Not a Function, though it gets the job done.

Public Class Form1
    Private iT As Integer = Nothing '// TEMP.Integer to get # at end of TextBoxes.

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        setHandlersForCoolTextBoxes()
    End Sub

    Private Sub setHandlersForCoolTextBoxes()
        '/////////////////////////////////////////////////////////////////
        For Each txt As TextBox In New TextBox() {TextBox1, TextBox2, TextBox3, TextBox4} '// add your TextBoxes here.
            '/////////////////////////////////////////////////////////////////
            AddHandler txt.KeyDown, AddressOf _myCoolTextBoxes_KeyDown
        Next
    End Sub

    Private Sub _myCoolTextBoxes_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then setFocusToNextCoolTextBox(CType(sender, TextBox)) '// send current TextBox to Sub.
    End Sub

    Private Sub setFocusToNextCoolTextBox(ByVal selCurrentCoolTextBox As TextBox)
        With selCurrentCoolTextBox.Name
            iT = CInt(.Substring(.LastIndexOf("x") + 1)) + 1 '// get # at end of TextBo"x"# and add+1 for next TextBox, if Available.
        End With
        If Not CType(Me.Controls("TextBox" & iT.ToString), TextBox) Is Nothing Then '// if Available.
            With CType(Me.Controls("TextBox" & iT.ToString), TextBox)
                .Select()
                .BackColor = Color.LightSkyBlue  '// FOR.TESTING.
            End With
        Else
            MsgBox(".you need more TextBoxes you s.o.b.! xD", MsgBoxStyle.Information, ".just because.")
        End If
    End Sub
End Class
adam_k commented: Nice +8
M.Waqas Aslam commented: exactly what i needed :) cheers +5
bilal_fazlani commented: awessome!! +2
codeorder 197 Nearly a Posting Virtuoso
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        With Form2
            .TextBox1.Text = TextBox1.Text
            .Show()
        End With
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.:)

Public Class Form1
    Private arCmbItems() As String = {"item 1", "item 2", "item etc.", "item.Else"}

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With ListBox1
            .Items.AddRange(arCmbItems) '// add items to ListBox from String.Array.
        End With
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        With ListBox2.Items
            If Not ListBox1.SelectedIndex = -1 Then '// check if item is selected since Index.of -1 is No.Item.Selected.
                .Clear() '// .Clear for new input.
                Select Case ListBox1.SelectedItem '// check value selected.
                    Case arCmbItems(0) '// case 1st.item.
                        .Add("1a") : .Add("1b") : .Add("1c")
                    Case arCmbItems(2) '// case 3rd.item.
                        .Add("etc.a") : .Add("etc.b") : .Add("etc.c")
                    Case arCmbItems(1) '// case 2nd.item.
                        .Add("2a") : .Add("2b") : .Add("2c")
                    Case Else '// if any other item selected.
                        .Add("No items")
                        .Add("in String.Array")
                        .Add("for this .SelectedItem")
                End Select
            End If
        End With
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

#Region is to be able to collapse an entire "region" of code and minimize the area of your code window. Your little trigger happy finger should be happy to Not have to scroll as much also.

codeorder 197 Nearly a Posting Virtuoso

>>I have 1 rich text box that the data gets displayed in.
That's what I was looking for, thanx.:)

Imports System.IO
Public Class Form1
    Private myNamesFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myNamesFile.txt"
    Private arFileLines() As String = Nothing

    Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        myCoolSaveSub(myNamesFile, RichTextBox1)
    End Sub

#Region "-----===-----===-----===  ===-----===-----===-----"
    Private Sub myCoolSaveSub(ByVal selCoolFile As String, selCoolRichTextBox As RichTextBox)
        File.WriteAllLines(selCoolFile, selCoolRichTextBox.Lines)
        MsgBox("file.saved.")
    End Sub
#End Region
End Class
codeorder 197 Nearly a Posting Virtuoso

>>where does that code save the file to?
Private myNamesFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myNamesFile.txt"
>>What are the 3 text boxes for?
I used them as an example to write content back to the file.
.reason was: I had no idea other than >>i have a prompt that allows me to enter the number of names and the names themselves.
.thus I used TextBoxes.

If you specify on how and what controls contain those "names" for you to save/load the names to/from, then I will have a better understanding towards supplying a possible solution.
>>im sorry if i seem naggy or rude about this
.never even crossed my mind.:)

codeorder 197 Nearly a Posting Virtuoso

.see if this helps.

Imports System.IO
Public Class Form1
    Private myFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\test.txt"
    Private arFileLines() As String = Nothing

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        myCoolSub()
    End Sub
    Private Sub myCoolSub()
        If File.Exists(myFile) Then
            arFileLines = File.ReadAllLines(myFile)
            For i As Integer = 0 To arFileLines.Length - 1 Step +2 '// loop thru file.lines and skip reading every other line.
                MsgBox(arFileLines(i) & vbNewLine & arFileLines(i + 1))
            Next
        End If
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

.actually, see If this helps w/saving.

Imports System.IO
Public Class Form1
    Private myNamesFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myNamesFile.txt"
    Private arFileLines() As String = Nothing

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        myCoolSaveSub()
    End Sub
    Private Sub myCoolSaveSub()
        arFileLines = New String() {TextBox1.Text, TextBox2.Text, TextBox3.Text}
        File.WriteAllLines(myNamesFile, arFileLines)
        MsgBox("file.saved.")
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        myCoolSub()
    End Sub
    Private Sub myCoolSub()
        If File.Exists(myNamesFile) Then
            arFileLines = File.ReadAllLines(myNamesFile)
            MsgBox(arFileLines(1)) '// get line.2 from File.
        End If
    End Sub

>>how would i write a Private Sub to save the info in the array?
.save to.file? or just add values to the Array? andAlso from where/what controls?

codeorder 197 Nearly a Posting Virtuoso

See if this helps to load.File into Array.

Imports System.IO
Public Class Form1
    Private myNamesFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "myNamesFile.txt"
    Private arFileLines() As String = Nothing

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If File.Exists(myNamesFile) Then
            arFileLines = File.ReadAllLines(myNamesFile)
            MsgBox(arFileLines(1)) '// get line.2 from File.
        End If
    End Sub
End Class

.make sure you have at least 2 lines in your myNamesFile .

codeorder 197 Nearly a Posting Virtuoso

>>@codeorder, if im allowed i would suggest...
.suggest as you may, I'm still trying to crack this s.o.b. out; tough cookie though.:)
Do post a sample.code that might help to a better solution. Return "thanx" .

codeorder 197 Nearly a Posting Virtuoso

.thanx for p.m. w/link to thread; will try to figure out a better way to sort.items and reply; though in the mean.while, I hope that others will try to provide possible solutions since those always seem to help for such threads as this.:)

codeorder 197 Nearly a Posting Virtuoso

Thanks for the att.File, though I do not run uploaded.exe Files; especially If Not from a trusted.download sight as Download.com.
<<My.Apologies?
...again?

If you have any questions that you think I might be able to answer, do notify me.
As for me wasting My.time and getting nowhere, again, not hapenning "again". Good luck w/this thread, I am out of here.

codeorder 197 Nearly a Posting Virtuoso

>>Dude it works
>>I just dont understand how it works ????
<<How exactly does this "work" w/your most recent posted.code, since I get no results from it?

codeorder 197 Nearly a Posting Virtuoso

No man its okay
Okay so Ive got it working but the Example very advanced
or doesnt really make much sense

For Each proc In Form3.ListBox2.Items
                Dim ppdd() As Process = System.Diagnostics.Process.GetProcessesByName(proc.ToString.ToLower.Split(".")(0))
                For Each p As Process In ppdd
                    p.Kill()
                Next
            Next

How exactly does this "work" w/your most recent posted.code, since I get no results from it?Not even a MsgBox instead of .Kill.

codeorder 197 Nearly a Posting Virtuoso

I've been out all day, really tired, though I still noticed that you have not posted the code that loads the .Processes into your ListBox?

Since that was too much of a difficult task for you to do, even after 100+attempts of posting:D, why not just post one or 2 of the ListBox.Items(Processes) in your next post.

I mostly need to see how they are loaded into your ListBox, If FullPath, ElseIf only FileName, etc.. This because I am also a bit confused on how you can .Split by the "." and still get a For/Next loop out of one .Item(Process?).

codeorder 197 Nearly a Posting Virtuoso

Post the code that loads the .Processes in your ListBox.
I'll use the code you currently have here and will try to "make sense" of how it works, then will post a possible "understand.Me.NT":D of how it works.:)

codeorder 197 Nearly a Posting Virtuoso

:'( I don't know how!!! :'(

I did however noticed that your are Dim 'ing inside a For/Next loop. From my perspective, I think that it is overworking someone's p.c. to the bone by constatly Dim 'ing something.
Why not Dim just before the For/Next and reuse that Variable in the loop, instead of constantly setting new Variables ?

Hope it helps.:)

codeorder 197 Nearly a Posting Virtuoso

>>No you are not understanding...
My.Apologies?for not understanding and good.luck since I am out of possible suggestions/solutions regarding this thread.