Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Most textbox filters are for categories of keystrokes - for example, upper and/or lower case letters, digits, etc. In these cases it is faster (although not noticibly) and clearer (which is almost always desirable) to use ranges. As such,

Select Case e.KeyChar
    Case "0" To "9"     'allow digit
    Case "a" To "z"     'allow lower case letter
    case 'A' To 'Z'     'allow upper case letter
    Case Else:          e.Handled = True
End Select

is immediately obvious even without the comments. It is also easy to modify. If you use a list (or array) of numbers like you are doing, it is necessary to first translate the numbers into the corresponding characters, then scan through that list to ensure that the coder did not (deliberately or accidentally) omit one character, or incorrectly enter a value. That is not good coding.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I admit that the following

For i = 0 to "4"

is effectively the same as

For i = 0 to 4

however, it requires an implicit conversion from string to integer and is a bad thing to do code wise. It is the equivalent of a farmer counting the feet and dividing by four to get the number of sheep. If it obscures the true intent of the code then it is probably a bad idea.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Note that I've Declared k as integer
K = 0 To recno.ToString

It doesn't matter how you declare k. recno.ToString does not result in an integer value and in any case it is not a valid statement because it is missing the For keyword.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Studies have shown that the easier it is to spend money, the more we tend to spend. If you have to open your wallet and take out actual physical money you tend to spend less because

  1. it's physically more involved than other methods
  2. it more easily reminds you that you have a limited amount of money
  3. once the cash runs out you pretty much have to stop buying stuff

Credit cards made it easier for people to spend money they didn't have because a credit card does not remind you that your cash is dwindling. It always looks the same whether you have a thousand dollars or are a thousand in debt.

But at least with a credit card you still have to take out your wallet (a physical reminder of your finances) and take out the card. With Apple's new Apple Pay you just take out your iPhone and the connection to your actual money is now broken. Supposedly with the SmartWatch you will eventually be able to just wave your watch over a sensor and spending money you don't have will be easier than it's ever been before.

Welcome to the next financial crash.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Use the ORDER BY clause with DESC when you do the SELECT.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If recno is a string and has the value "4" then recno.Length evaluates to 1 which is the length of the string. Perhaps you want CInt(recno) which will give you the number 4.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What is recno.Length and what is its value? Please post the code associated with recno.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I suggest you watch episode 7 of Silicon Valley with particuular attention to minutes 23-24. They do a montage of a number of presenters with every one parroting the phrases "our software will revolutionize the way you..." and "...making the world a better place". The tech industry relies on hype to survive. As Theodore Sturgeon famously said, "ninety percent of everything is crap." That isn't to say the iPhone is crap. It's a remarkable product but when I see people lining up outside the stores days in advance just so they can get the latest version (look, it's 0.5mm thinner) I just scratch my head.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

George Carlin once said that if you nail two things together that have never been nailed together before, some idiot will buy it from you.

LOOK!!! IT'S A WATCH!!! AND IT'S SMART!!!. OOOH. SHINY.

We really need to start teaching people how marketing is making everyone stupid.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Chill. It's just a phone. I refer you to this.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The following code will allow/prevent the entry of specific keys. Add a Case statement for each key or range of keys you want to allow. Note that you have to add a Case to allow BackSpace but not Left/Right Arrow or Delete.

Public Class Form1

    Private Sub TextBox1_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

        'Remove the following line for production code
        Me.Text = "ASC " & Asc(e.KeyChar) & "    HEX " & Asc(e.KeyChar).ToString("X2")

        Select Case e.KeyChar
            Case "0" To "9"     'digit
            Case "-"            'dash
            Case Chr(8)         'backspace
            Case Else:          e.Handled = True
        End Select

    End Sub

End Class
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't see the problem.

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

    For Each pbx As PictureBox In Me.Controls.OfType(Of PictureBox)()
        AddHandler pbx.MouseEnter, AddressOf pbx_MouseEnter
    Next

End Sub

Private Sub pbx_MouseEnter(sender As System.Object, e As System.EventArgs)
    DirectCast(sender, PictureBox).ImageLocation = ("d:\temp\11213.jpg")
End Sub

works just fine for me, but you might want to do

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

    For Each pbx As PictureBox In Me.Controls.OfType(Of PictureBox)()
        AddHandler pbx.MouseEnter, AddressOf pbx_MouseEnter
        AddHandler pbx.MouseLeave, AddressOf pbx_MouseLeave
    Next

End Sub

Private Sub pbx_MouseEnter(sender As System.Object, e As System.EventArgs)
    DirectCast(sender, PictureBox).ImageLocation = ("d:\temp\11213.jpg")
End Sub

Private Sub pbx_MouseLeave(sender As System.Object, e As System.EventArgs)
    DirectCast(sender, PictureBox).ImageLocation = Nothing
End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This doesn't cause the error, but you should not use the form Me.i. Just use the variable name without the Me qualifier. As for the error, try the loop

For Each pbx As PictureBox In Me.Controls.OfType(Of PictureBox)()
    AddHandler pbx.MouseEnter, AddressOf highlight
Next

If that doesn't fix the problem then perhaps you could be more specific as to what the symptoms are.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Been using it off and on for more than a year.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm with you except for some big band, some Brubeck and some Mancini. John Coltrane should be considered cruel and unusual punishment akin to waterboarding.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

"_0" is not an integer. Strip off the underscore before you try to convert.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could try how to remove vmhost.exe first.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the movie THX 1138, a voice on a car radio says "I think I ran over a wookie back there on the expressway."

Just thought I'd throw that out there.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What is the error? Please post the full text and identify the line causing the error.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Do you recall a Kodak commercial from years ago with Mariette Hartley and James Garner. He says to her, "that doesn't make sense." She replies, "you mean you don't understand it."

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What is the make and model of your Dell system? I have a Dell Inspiron 1720 (32 bit) and I'm running Windows 7.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Imagine the noise just from mowing your lawn.

ddanbe commented: You made my day! Could not stop laughing for about5 minutes! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When you drop a label onto the form at design time it is added to the Controls collection of the main form (Me). This is the same as if you created it at run time and did

Me.Controls.Add(newlabel)

What you want to do is to add the label to the Controls collection of the PictureBox. Simply stated, you are making PictureBox1 the Parent (or container) control for the label.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Public Class Form1

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

        Label1.Text = ""
        Label1.Parent = PictureBox1
        Label1.BackColor = Color.Transparent

    End Sub

    Private Sub btnShow_Click(sender As System.Object, e As System.EventArgs) Handles btnShow.Click

        Label1.Text = "Some text"

    End Sub

    Private Sub btnHide_Click(sender As System.Object, e As System.EventArgs) Handles btnHide.Click

        Label1.Text = ""

    End Sub

End Class

Works for me. You don't even have to make the background colour transparent.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Add a label to the form at design time and on form load do

Label1.Parent = PictureBox1
Label1.BackColor = Color.Transparent

When you assign text to the label it will be visible. To make it disappear just assign the null string to the label. If the label text is the same colour as the picture you may have to temporarily set the BackColor to something other than Transparent.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Yes. And as I said, you do not need a timer. Just update the value from inside the loop on form2.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
ProgressBar1.Value += 1
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My senior year of high school was the only year of school up to then that I enjoyed. I got involved in our production of My Fair Lady. I started on scenery then ended up in the cast. That spring when our geography teacher took a group of students to Mexico, 90% of the group ended up being from the musical.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You don't need to use a timer to update the progress bar. Just increment the progressbar value in the loop you are tracking. As for the cross form update, why not just put the progress bar on the form containing the loop?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Disney will probably add "based on a true story" to the intro.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sounds like homework. What have you got so far?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The only reason that the Leia / Han romance worked pretty well in the original series is because it just came out naturally from the chemistry of the actors, the contrast between the characters, and the well-written dialogue between them.

It didn't hurt that Carrie Fisher and Harrison Ford were romantically involved during filming. Apparently the chemsitry wasn't just on-screen.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

First of all, JJ Abrams doesn't know shit about Star Trek. See the excellent Star Trek by the Minute blog for more explanation. Against my better judgement I watched "Star Trek Into Darkness". More of the same nonsense and idiotic plot holes. for example, they establish that the new transporters can transport with shields up (Carol Marcus is taken off the Enterprise), then cannot (Khan is unable to beam his "crew" off the Enterprise). Then there is the "Windows pipes screen saver" nightmare of en engine room. Does Abrams think that the Enterprise is steam powered?

For the record, Harrison Ford actually wanted the role of Han Solo but was refused by George Lucas. He was, however, allowed to read with the cast until Lucas finally relented.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you use a Dictionary (also known as an associative array) you can do the following:

Dim cars As New Dictionary(Of String, Integer)

For Each item As String In {"Opel,5", "BMW,7", "Renault,12", "Opel,3", "Renault,6"}

    Dim flds() As String = item.Split(",")
    Dim car As String = flds(0)
    Dim num As Integer = CInt(flds(1))

    'If the car is already in the dictionary then add the new number
    'to the total, otherwise add the new car name and number.

    If cars.ContainsKey(car) Then
        cars(car) += num
    Else
        cars.Add(car, num)
    End If

Next

'Populate the listview with the unique car data

For Each car As String In cars.Keys
    lvwCars.Items.Add(New ListViewItem({car, cars(car)}))
Next

Just replace the For line to read from a file instead of a string. If you need to persist the values in the dictionary then move it to the class level.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The obvious question is do you have Microsoft Word installed on the tablet?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There is already a builtin way to generate a unique reference. It's called a GUID and you can use it as follows:

Dim g As System.Guid = System.Guid.NewGuid

It will generate a result of the form

e57bf525-4b8e-4d09-98aa-53fe997acfb8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've never tried it but I understand that to post by email you have to select Subscribe to Mailing List?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In one case you will get notified only for articles that you explicitly request to Watch. If you select the Auto option then by posting in a thread you have (implicitly) selected Watch. With the non-auto option you can Watch a thread without posting in it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Go to Edit Profile and make sure you check Receive Occasional Community-related Email?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sort of like forking a software project, right Stuugie?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How about

For Each tbx As TextBox In Me.Controls.OfType(Of TextBox)()
    If Not tbx.ReadOnly Then
        tbx.Text = ""
    End If
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

CTRL W = close (browser tab)
CTRL O = open (standard app hotkey)

Close your eyes and open your mind.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Experiments suggest that time is an emergent property of the universe that is not observable from the outside.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You must have really aced that speed reading course.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think I have that book in my archives. I recall reading it years ago.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why not just use the free version if vb.net? You can create a form and drop all the controls on it. You don't have to write any code to create a mock-up of the GUI.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I used the same technique as everything else. Practice. The only way to get good at something is to keep doing it. I also had some excellent instructors along the way (and a few really bad ones).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For all we know the OP could be using an unsourced DataGridView. Judging by the last picture I would imagine that AllowUserToAddRows is set to False otherwise there would be a blank (uncommitted) row displayed after the two records.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try

For r As Integer = dgvMyGrid.Rows.Count - 1 To 0 Step -1

    Dim empty As Boolean = True

    For Each cell As DataGridViewCell In dgvMyGrid.Rows(r).Cells
        If Not IsNothing(cell.Value) Then
            empty = False
            Exit For
        End If
    Next

    If empty Then dgvMyGrid.Rows.RemoveAt(r)

Next

You want to delete from the bottom to the top because if you delete from the top first then you end up changing the number of rows while the loop is executing.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sounds like homework questions to me. Try here.

iConqueror commented: cheers +0