codeorder 197 Nearly a Posting Virtuoso

You have to dream before your dreams can come true

And imagination is the beginning of all dreams.
codeorder 197 Nearly a Posting Virtuoso
I cannot make my decisions, for I only make .My decisions.
anand01 commented: true +0
codeorder 197 Nearly a Posting Virtuoso
In exchange of thoughts, messages, or information, I define the reverse.engineering of communication.
codeorder 197 Nearly a Posting Virtuoso
If you can find the key to .Me, open your mind to your soul and close your mind to your doubt.
codeorder 197 Nearly a Posting Virtuoso
To keep a beat, this world beholds the Heart of the Universe, eternally.mine As.well.
codeorder 197 Nearly a Posting Virtuoso
Without a heart, the soul looses it's mind.
codeorder 197 Nearly a Posting Virtuoso
If I could shoot my.self in the foot, I would aim for the other foot first.
codeorder 197 Nearly a Posting Virtuoso
The free.will of humanity on Earth, is now part of .My life; universally bonded in mind, body, soul, and...
codeorder 197 Nearly a Posting Virtuoso
Never fail to realize, that even a dragon has his sweetheart.
codeorder 197 Nearly a Posting Virtuoso
Plan B is always better than plan A. Reason: You already have the blueprints for plan A to make progress with.
codeorder 197 Nearly a Posting Virtuoso
Anybody else gotta pee again? Sucks getting old. :(
codeorder 197 Nearly a Posting Virtuoso
"yet", as in "Not yet.", is a sign towards something that could someday be great, if hope is involved.
codeorder 197 Nearly a Posting Virtuoso
A great wise.someone once said "It's all fun and games until 'someone' gets hurt.", though what will another to be a great wise.someone have to say about it "when that 'someone' dies in the process"?
codeorder 197 Nearly a Posting Virtuoso

WebBrowser1.Document.Forms(0).InvokeMember("submit")

codeorder 197 Nearly a Posting Virtuoso

As Mitja Bonca's post, declare your Class Level Integer( int counter; ) at the top of the Form's code window, not in a Sub/etc.. This keeps track of how many clicks.
.on Form.Load, check if a certain.File.Exist and if it does, load the file, read it, and set the value from the file to your int counter; . If it does not exist, just skip.
Now, to make it all work, when closing the app, only save "counter" Integer to the same certain.File you checked if existed on Form.Load.

codeorder 197 Nearly a Posting Virtuoso

>>in the property in the option MRL i gave the video address which should be played
Seems that the url for the Files are not located in the same directory as the user's.directory.
.ex: If your directories are "C:/some folder on my vb.net p.c./" Then If your user's directories are Not "C:/some folder on my vb.net p.c./" AndAlso user want's to watch vid on "C:/some folder on my vb.net p.c./" Return :).

codeorder 197 Nearly a Posting Virtuoso

>>yes it want support on this
See if this helps.:)

Imports System.IO
Public Class Form1
    Private myFile As String = "c:\test.txt"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.Items.AddRange(New String() {"1", "f1", "f2"})
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Static selCoolItem As String '// stores the .SelectedItem to verify against the previously .SelectedItem.
        With ListBox1
            If Not .SelectedIndex = -1 Then '// if itm selected.
                If Not selCoolItem = .SelectedItem Then '// check if same item as previously .SelectedItem, if one selected.
                    selCoolItem = .SelectedItem '// store .SelectedItem in String.
                    For Each itm As String In File.ReadAllLines(myFile) '// read File.Lines and...
                        If itm = selCoolItem Then Return '// ...Exit Sub w/less typing. ;)
                    Next
                    Dim w As New IO.StreamWriter(myFile, True) : w.WriteLine(selCoolItem) : w.Close() '// append to File.
                End If
            End If
        End With
    End Sub
End Class
gozo12 commented: Oh god :) . this is worked perfectly . THANKS YOU SO MUCH AGAIN +1
codeorder 197 Nearly a Posting Virtuoso

Also, see if this helps.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.Items.AddRange(New String() {"1", "f1", "f2"})
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Static selCoolItem As String '// stores the .SelectedItem to verify against the previously .SelectedItem.
        With ListBox1
            If Not .SelectedIndex = -1 Then '// if itm selected.
                If Not selCoolItem = .SelectedItem Then '// check if same item as previously .SelectedItem, if one selected.
                    selCoolItem = .SelectedItem '// store .SelectedItem in String.
                    Dim w As New IO.StreamWriter("c:\test.txt", True) : w.WriteLine(selCoolItem) : w.Close() '// append to File.
                End If
            End If
        End With
    End Sub
End Class

If you don't want the same item to be added to the file, load File in an Array, loop thru all lines and if item found Then Exit the entire Sub with "Exit Sub". If not found, have the code to append to file just underneath your For/Next loop.

gozo12 commented: ITS REALLY WORKED :D THANKS YOU SO MUCH +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

With DataGridView1
            Static iTopRow As Integer
            iTopRow = .FirstDisplayedScrollingRowIndex '// get Top row.
            Form2.ShowDialog()'// Form that edits record.
            .FirstDisplayedScrollingRowIndex = iTopRow '// set Top row.
        End With
codeorder 197 Nearly a Posting Virtuoso

Not a database coder here, though could you not remove InvNomer, from sSql = "SELECT FullName ,InvNomer, BalanceDue From Invoice" and have it as sSql = "SELECT FullName , BalanceDue From Invoice" ?

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
        For Each txt In New TextBox() {TextBox1, TextBox2, TextBox3} '// your TextBoxes.
            If txt.Text = "" Then Exit Sub '// skip remain code in Sub.
        Next
        Button2.Enabled = True '// enable if all TextBoxes have values.
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button2.Enabled = False
    End Sub
Jx_Man commented: Great help for sure :) +14
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub _ListProduct_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListProduct.KeyDown
        With CType(sender, ListView)
            If Not .Items.Count = 0 Then
                .MultiSelect = False
                e.Handled = True '// block default handling.
                Select Case e.KeyCode
                    Case Keys.Up
                        .Items(0).Selected = True '// select first item.
                    Case Keys.Down
                        .Items(.Items.Count - 1).Selected = True '// select last item.
                End Select
                .SelectedItems(0).EnsureVisible() '// make sure that item is visible once selected.
                .HideSelection = False '// keep cute highlight on item.
            End If
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

I d/l'ed the project and got the "Black Ops" issue taken care of.
.The issues laid inside the Private Sub KillStreaks() (located it by commenting out lines for each called Sub) and I am not exactly certain as to why it froze, though I froze also when I took a look at the code inside that Sub.:D

I tried following along the same guidelines as the code posted w/in that Sub and hopefully this helps.
.Just replace your entire Private Sub KillStreaks() with the following code.

Private rnd As New Random '// DECLARED ONCE AND USES THE FUNCTION.

    Private Function getCoolRandomNumber(ByVal minCoolNumberValue As Integer, ByVal maxCoolNumberValue As Integer) As Integer
        rnd = New Random
        Return rnd.Next(minCoolNumberValue, maxCoolNumberValue)
    End Function
#Region "-----===-----===-----===-----===-----=== KILL STREAKS ===-----===-----===-----===-----===-----"
    Private Sub KillStreaks()
        '// send a random# to set the selected KillStreak.
        setKillStreaks(getCoolRandomNumber(1, 9), 1)
        setKillStreaks(getCoolRandomNumber(1, 9), 2)
        setKillStreaks(getCoolRandomNumber(1, 9), 3)
    End Sub

    Private Sub setKillStreaks(ByVal selRandomNumber As Integer, ByVal selKillStreak As Integer)
        Select Case selRandomNumber
            Case 1
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "RC-XD")
                End Select
            Case 2
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "COUNTER-SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "SAM TURRET")
                End Select
            Case 3
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "CARE PACKAGE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "NAPALM STRIKE")
                End Select
            Case 4
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SENTRY GUN")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "MORTAR TEAM")
                End Select
            Case 5
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "ATTACK HELICOPTER")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "VALKYRIE …
Tobyjug2222 commented: Great Feedback - Will work on the code now! :D +1
codeorder 197 Nearly a Posting Virtuoso

I used a DGV with 3 columns for this, hope it helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        setHighLightsForConflicts(DataGridView1)
    End Sub
    Sub setHighLightsForConflicts(ByVal selDGV As DataGridView)
        With selDGV
            Dim s1, s2 As String, chrMain As Char : s1 = "" : s2 = s1 : chrMain = "|"
            For i As Integer = 0 To .RowCount - 1 '// loop thru all rows.
                With .Rows(i)
                    s1 = .Cells(0).Value & chrMain & .Cells(1).Value & chrMain & .Cells(2).Value '// store the row's value, easier to manage and compare to other rows.
                End With
                If Not i + 1 = .RowCount Then '// check if next item to check exists.
                    For x As Integer = i + 1 To .RowCount - 1 '// loop thru all items following the s1.Item.
                        With .Rows(x)
                            s2 = .Cells(0).Value & chrMain & .Cells(1).Value & chrMain & .Cells(2).Value '// set value.
                            If s1 = s2 Then '// compare and get results.
                                .DefaultCellStyle.BackColor = Color.Aquamarine
                                selDGV.Rows(i).DefaultCellStyle.BackColor = Color.Aquamarine
                            End If
                        End With
                    Next
                End If
            Next
        End With
    End Sub
amf101 commented: Your great!continue sharing your knowledge...and i will be back for more questions if you don't mind..hehe:D..thanks again! +1
codeorder 197 Nearly a Posting Virtuoso
With TextBox1
            Dim arLines() As String = .Lines '// get all lines into a String.Array.
            arLines(2) = "line.3 has been updated" '// update selected line.
            .Lines = arLines '// add lines back to TextBox.
        End With
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
New.Project, 3.Buttons, 3.Panels(view attached image)

Public Class Form1
    Private pnTemp As Panel, iSelPanel As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        pnTemp = Panel1 '// pnTemp, just easier to work w/. :)
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        pnTemp = Panel2
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        pnTemp = Panel3
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

#Region "-----===-----===-----===-----===-----===  ===-----===-----===-----===-----===-----"
    Private Sub collapsePanel(ByVal selPanel As Panel)
        With selPanel.Name
            iSelPanel = CInt(.Substring(.Length - 1)) '// get # at end of Panel.Name.
        End With
        For i As Integer = 0 To selPanel.Height '// loop from 0 to panel.height
            selPanel.Height -= 1 '// ...and reduce height.
            For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} '// loop thru all btns and panels.
                If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then '// check if # at end of btn/panel is greater than the selectedPanel.
                    ctl.Top -= 1 '// move btn/panel up.
                End If
            Next
        Next
    End Sub
    Private Sub expandPanel(ByVal selPanel As Panel, Optional ByVal iPanelHeight As Integer = 125)
        With selPanel.Name
            iSelPanel = CInt(.Substring(.Length - 1))
        End With
        For i As Integer = 0 To iPanelHeight
            selPanel.Height += 1
            For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3}
                If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) …
codeorder 197 Nearly a Posting Virtuoso

For this typeOf(issue), use a Boolean; reason: Booleans only toggle between a True/False and Nothing Else.

Public Class Form1
    Private myFolder As String = "\My Documents\"
    Private myFile As String = myFolder & "123.txt" '// file to check if .Exists.
    Private WithEvents tmrFileExists As New Timer With {.Interval = 1000, .Enabled = True} '// dynamic Timer.
    Private bIsButtonClickable As Boolean = True '// Boolean to determine if Button is clickable.

    Private Sub tmrFileExists_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrFileExists.Tick
        If mySelectedCoolFileExists() = True Then
            _Button1_Click(sender, New System.EventArgs())
        Else
            bIsButtonClickable = True
        End If
    End Sub

    Private Sub _Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If bIsButtonClickable = True Then
            If mySelectedCoolFileExists() = True Then
                bIsButtonClickable = False
                MessageBox.Show("file exits")
            End If
        End If
    End Sub
    Private Function mySelectedCoolFileExists() As Boolean
        If System.IO.File.Exists(myFile) = True Then
            Return True
        Else
            Return False
        End If
    End Function
End Class

It checks twice for the File, though if it were not morning here, I would have had it check for the file only once, by using another Boolean of course.:)

Other than that, glad I could be your wing.man for the time being and glad I could help.:)

cheekangteh commented: solution +1
codeorder 197 Nearly a Posting Virtuoso

>>which one cannot be considered as a counter variable?
I would say line.4.
.reason: Dim counter As Integer is = to a default.value of 0 and no other line returns a 0 AndAlso counter = 0 *2 will give you the same result as counter = counter *2 .
.p.s.: I don't even know w.t.f a "counter variable" is;though hope this helps.:)

codeorder 197 Nearly a Posting Virtuoso

Disregard my previous post If this takes care of the issue.

Public Class Form1
    Private lClock As Label, btnStop As Button, sw() As Stopwatch
    Private iTotalParticipants As Integer '// keep count of players.
    Private sButtonName As String = "Stop", sLabelName As String = "Clock", sButtonDone As String = "Done"
    Private pnMain As Panel

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        pnMain = Panel1 '// Take control of Panel.
        With Button1 : .Text = ".new" : .Cursor = Cursors.Hand : End With
        With Button2 : .Text = ".add" : .Cursor = Cursors.Hand : End With
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        pnMain.Controls.Clear() '// clear.Panel.
        iTotalParticipants = 0 '// reset players.
        createInitialStopWatches(2) '// start w/2 players.
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        createInitialStopWatches(1) '// a single player.
    End Sub
#Region "-----===-----===-----===-----===-----=== DYNAMIC.CONTROLS ===-----===-----===-----===-----===-----"

    Private Sub createInitialStopWatches(ByVal numberOfParticipantsToAdd As Integer)
        For i As Integer = 1 To numberOfParticipantsToAdd
            iTotalParticipants += 1 '// increase players total.
            addStopWatchControls(iTotalParticipants) '// add new.player's controls.
        Next
    End Sub

    Private Sub addStopWatchControls(ByVal selCtlIndex As Integer)
        ReDim Preserve sw(iTotalParticipants) '// Redim the StopWatch.Array and keep previous stopWatches.
        sw(selCtlIndex) = New Stopwatch '// new stopWatch for new participant.
        sw(selCtlIndex).Start()

        lClock = New Label : With lClock
            .Name = sLabelName & selCtlIndex
            .Size = New Size(100, 20) : .Location = New Point(139, (5 + ((selCtlIndex - 1) * 26)))
            .BorderStyle = BorderStyle.Fixed3D : .TextAlign = ContentAlignment.MiddleRight
        End With : pnMain.Controls.Add(lClock) '// add.Label.

        btnStop = New Button …
thedonedeal commented: Love It.. Just a bit of tinkering on my end. But thanks! +2
codeorder 197 Nearly a Posting Virtuoso

I had a chance to play w/this "stopwatch" thread and got this.

Public Class Form1
    Private lParticipantClock As Label, btnParticipantStop As Button, tmrParticipantTimer As Timer
    Private iTotalParticipants As Integer

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        iTotalParticipants = 5
        createStopWatches(iTotalParticipants)
    End Sub

    Private Sub createStopWatches(ByVal TotalParticipants As Integer)
        For indexCounter As Integer = 1 To TotalParticipants Step 1

            lParticipantClock = New Label : With lParticipantClock
                .Name = "participantClock" & indexCounter
                .Size = New Size(100, 20) : .Location = New Point(139, (5 + ((indexCounter - 1) * 26)))
                .BorderStyle = BorderStyle.Fixed3D : .TextAlign = ContentAlignment.MiddleRight
            End With : CenterPanel.Controls.Add(lParticipantClock)

            btnParticipantStop = New Button : With btnParticipantStop
                .Name = "ParticipantStop" & indexCounter
                .Size = New Size(58, 20) : .Location = New Point(245, (5 + ((indexCounter - 1) * 26))) : .Cursor = Cursors.Hand
                .BackColor = Color.Red : .ForeColor = Color.White : .Font = New Font(.Font, FontStyle.Bold) : .Text = "Stop"
                AddHandler .Click, AddressOf _ParticipantButtons_Click
            End With : CenterPanel.Controls.Add(btnParticipantStop)

            tmrParticipantTimer = New Timer : With tmrParticipantTimer
                AddHandler .Tick, AddressOf _ParticipantTimers_Tick
                .Interval = 1 : .Start()
            End With
        Next
    End Sub

    Private Sub _ParticipantButtons_Click(sender As System.Object, e As System.EventArgs)
        CType(sender, Button).Text = "done"
    End Sub
    Private Sub _ParticipantTimers_Tick(sender As System.Object, e As System.EventArgs)
        Static iCounter As Integer = -1
        iCounter += 1
        For i As Integer = 1 To iTotalParticipants
            If Not CType(CenterPanel.Controls("ParticipantStop" & i.ToString), Button).Text = "done" Then
                CType(CenterPanel.Controls("participantClock" & i.ToString), Label).Text = iCounter.ToString("00:00:00")
            End If
        Next
    End Sub
End Class

Could Not use StopWatch.Value for some odd reason.

thedonedeal commented: This is EXACTLY what I was aiming for :). Now I just need to learn what the syntax does as I haven't seen it before. +2
codeorder 197 Nearly a Posting Virtuoso

Since your recent post and only wanting the lines that contain a .tif image, see if this helps.

Imports System.IO
Public Class Form1
    Private arlFileLines As New ArrayList
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim fbd As New FolderBrowserDialog '// declared in code, easier to manage.
        If fbd.ShowDialog = Windows.Forms.DialogResult.OK Then '// send all .txt files for evaluation.
            MsgBox("File lines containing images: " & getFileLinesCount(Directory.GetFiles(fbd.SelectedPath, "*.txt", SearchOption.AllDirectories)))
        End If
        '// FOR.TESTING/ETC.
        'If Not arlFileLines.Count = 0 Then
        '    For Each itm As String In arlFileLines
        '        MsgBox(itm)
        '    Next
        'End If
    End Sub
    Public Function getFileLinesCount(ByVal selCoolFiles() As String) As Integer
        arlFileLines.Clear()  '// reset to store non.duplicate lines.
        For Each selFile As String In selCoolFiles '// loop thru all found.files.
            For Each line As String In File.ReadAllLines(selFile) '// loop thru each file's lines.
                If line.Contains(".tif") Then
                    line = line.Substring(line.IndexOf("\") + 1, line.IndexOf(".tif") + 3 - line.IndexOf("\")) '// get .tif image from line.
                    If Not arlFileLines.Contains(line) Then arlFileLines.Add(line) '// if ArrayList does Not contain line, add.line.
                End If
            Next
        Next
        Return arlFileLines.Count
    End Function
End Class

>>Can you simplify my code or any suggestions?
I managed to do a little code clean up and added a Sub to save each file.

Public Function GetCountofTifString(ByVal iFolder As String) As Integer
        Dim intPos As Integer, strName As String = ""
        For Each tpath As String In Directory.GetFiles(iFolder, "*.txt", SearchOption.AllDirectories)
            intPos = (iFolder.LastIndexOfAny("\")) + 1
            strName = iFolder.Substring(intPos, (Len(iFolder) - intPos))
            Dim basa As New StreamReader(tpath)
            If …
codeorder 197 Nearly a Posting Virtuoso

This seems like a very big task to accomplish.
First off, using something as:

With WebBrowser1
            .Navigate("http://www.google.com/search?q=" & TextBox1.Text & " video")
        End With

Will not always return video links, it will return links to pages with videos.

The best solution I can offer is to search YouTube.

With WebBrowser1
            .Navigate("http://www.youtube.com/results?search_query=" & TextBox1.Text)
        End With

.get the link clicked, extract the video.ID, and load the video in the WebBrowser with the code I recently posted.
You can and should be able to do this with other video sites, If they allow you to embed their video player on your web.page, as YouTube does.

Hope this helps.

codeorder 197 Nearly a Posting Virtuoso

I have no idea(s) regarding "network.share", though here is a suggestion.
Have a small sidekick.app installed on each user's p.c., that does the "copy and overwrite the existing application executable in the program files\app directory".

I'm not sure how systems work with network.sharing, though there should be a folder somewhere, where everyone can access it.
If it does, load a simple .txt file in there, saying that there is a new.version and load your updated.exe in there also.

If their app. finds this file, Then to load the little sidekick.app, close it's self, and have the sidekick app do all the leg.work.

codeorder 197 Nearly a Posting Virtuoso

This should take care of the issue.

Private arFileLines(), sToLookFOr As String
    Private Function isFileValid(ByVal selCoolFile As String) As Boolean
        arFileLines = IO.File.ReadAllLines(selCoolFile) '// read file into array.
        sToLookFOr = "002"
        For i As Integer = 0 To arFileLines.Length - 1 '// loop thru all file lines, starting w/the second line.
            If arFileLines(i).StartsWith(sToLookFOr) Then '// check if current line startsWith your string to look for.
                '// get total of items"CInt(...)" following the line and loop thru the next lines until total.
                For i2 As Integer = i + 1 To i + CInt(arFileLines(i).Substring(12, 5))
                    If Not i2 > arFileLines.Length - 1 Then
                        If arFileLines(i2).StartsWith(sToLookFOr) Then Return False '// if not done w/the total of lines Then Return False.
                    Else
                        Return False '// if last line is missing.
                    End If
                Next
            End If
        Next
        Return True '// since it did not Return False, it can only be a valid File.
    End Function
renzlo commented: Very helpful man. +3
codeorder 197 Nearly a Posting Virtuoso

Use a Try/Catch for each itm and If you still get results, Then it is just that specific item that is not formatted properly.

For Each itm As ListViewItem In itms '// loop thru all itms in Array.
            Try
                With itm.SubItems(1).Text '// check Column2.Text
                    If CInt(.Substring(0, .IndexOf("/"))) = CInt(selCoolMonth) Then '// get all text prior to the first "/".
                        selCoolListView.Items.Add(itm) '// if a match, add to ListView.
                    End If
                End With
            Catch ex As Exception
                ' MsgBox(ex.Message)
            End Try
        Next
codeorder 197 Nearly a Posting Virtuoso

I did not watch the video, though I thought I'd supply a "watch youtube video with vb.net" solution.
1.WebBrowser,1.Button

Public Class Form1

    Private iVidHeight As Integer = 500, iVidWidth As Integer = 800
    Private iVidStyleVersion As Integer = 3 '// changes vid.style. 

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        playCoolYouTubeVid("phYaduairf8", WebBrowser1) '// play video.
    End Sub
    Private Sub playCoolYouTubeVid(ByVal selCoolVid As String, ByVal selCoolWebBrowser As WebBrowser)
        Dim sObject As String = "<object style=""height:" & iVidHeight & "px; width:" & iVidWidth & "px""><param name=""movie"" value=""http://www.youtube.com/v/" & selCoolVid & "?version=" & iVidStyleVersion & "&feature=player_detailpage""><param name=""allowFullScreen"" value=""true""><param name=""allowScriptAccess"" value=""always""><embed src=""http://www.youtube.com/v/" & selCoolVid & "?version=" & iVidStyleVersion & "&feature=player_detailpage"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" allowScriptAccess=""always"" height=""" & iVidHeight & "px"" width=""" & iVidWidth & "px""></object>"
        selCoolWebBrowser.DocumentText = sObject
    End Sub
End Class

To play the video, just copy the last part or any part of the url that contains the video.id.
.ex:
Vid.URL: http://www.youtube.com/watch?v=kg-z8JfOIKw
Vid.ID: kg-z8JfOIKw

codeorder 197 Nearly a Posting Virtuoso

Add this to Form1_Load , just after you setCoolListViewItemsInArray(ListView1) .

ComboBox1.SelectedIndex = 1 '// select 2nd item in ComboBox.

This will trigger the _ComboBox1_SelectedIndexChanged and cause it to fire off the code within.

.btw, welcome to the forum AndAlso glad I could help.:)

codeorder 197 Nearly a Posting Virtuoso

>>DateTimePicker1.Value = "01/JAN/" & DateTimePicker2.Value.Year
If you do not need to constantly change it to Jan.1st, see if this helps.

With DateTimePicker1
                .Value = New Date(DateTimePicker2.Value.Year, .Value.Month, .Value.Day)
            End With
GAiXz commented: satisfied? +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private itms() As ListViewItem '// stores itms from ListView.

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With ComboBox1.Items : For i As Integer = 1 To 12 : .Add(CStr(i)) : Next : End With '// load cmb(ComboBox).
        With ListView1.Items
            .Add(New ListViewItem("1,01/02/03".Split(",")))
            .Add(New ListViewItem("1,01/04/03".Split(",")))
            .Add(New ListViewItem("1,01/02/03".Split(",")))
            .Add(New ListViewItem("1,02/02/03".Split(",")))
            .Add(New ListViewItem("1,03/04/03".Split(",")))
            .Add(New ListViewItem("1,02/02/23".Split(",")))
        End With
        setCoolListViewItemsInArray(ListView1) '// IMPORTANT: after loading the ListView w/.Items, always set this.
    End Sub
    Private Sub setCoolListViewItemsInArray(ByVal selCoolListView As ListView)
        ReDim itms(selCoolListView.Items.Count - 1) '// reset the lenght of Array to lv.Items.Count
        For i As Integer = 0 To selCoolListView.Items.Count - 1
            itms(i) = selCoolListView.Items(i) '// set each array.itm as the appropriate lv.itm.
        Next
    End Sub

    Private Sub _ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        With ComboBox1
            If Not .Text = "" Then filterCoolListView(ListView1, .Text)
        End With
    End Sub
    Private Sub filterCoolListView(ByVal selCoolListView As ListView, ByVal selCoolMonth As String)
        selCoolListView.Items.Clear() '// clear for new input.
        For Each itm As ListViewItem In itms '// loop thru all itms in Array.
            With itm.SubItems(1).Text '// check Column2.Text
                If CInt(.Substring(0, .IndexOf("/"))) = CInt(selCoolMonth) Then '// get all text prior to the first "/".
                    selCoolListView.Items.Add(itm) '// if a match, add to ListView.
                End If
            End With
        Next
    End Sub
End Class

I tried using ListView.ListViewItemCollection , though it kept clearing the Collection every time I cleared the ListView; very odd.

codeorder 197 Nearly a Posting Virtuoso

Here's a start.up w/2 Forms.

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.Opacity = 0.5
        Form2.Show(Me) '// keeps Form2 onTop of Form1.
    End Sub
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.BackColor = Color.Azure '// set bg.color to some color you'll never use.
        Me.TransparencyKey = Me.BackColor '// turn Form.Clear.
        Me.Location = New Point(Form1.Location.X + 5, Form1.Location.Y + 15) '// set location.
    End Sub

When moving Form1 around, have it where it keeps the location of Form2 by using Form1_Move event, If needed.
.hope this helps.:)

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

...and these 2 words, lost me again.:D

dij_0983 commented: I'm not gonna post again as long as I see the words lost and again in the next posts ;) +0
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

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

A murderer's formula of religious belief: with the act of revealing or disclosing, is none other than Assassin's Creed: Revelations defined.

zeroliken commented: That's a great game :) +0
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

Try loading/saving the password to a File or My.Settings.
http://www.daniweb.com/software-development/vbnet/threads/312128/1335997#post1335997


I would encrypt the password a little, with something as simple as:
http://www.daniweb.com/software-development/vbnet/threads/375789/1617323#post1617323

Hope this helps.:)

adam_k commented: Agree, much better than xml for this use +8
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

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