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

Here's one suggestion. This example uses a form with KeyPreview = True. You need this in order to process the keystrokes.

Public Class Form1

    Private CurrBtn As Button = Nothing

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

        For Each btn As Button In Me.Controls.OfType(Of Button)()
            AddHandler btn.Click, AddressOf Button_Click
        Next

    End Sub

    Private Sub Form1_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp

        If IsNothing(CurrBtn) Then Exit Sub

        Me.Text = e.KeyCode

        Select Case e.KeyCode
            Case Keys.ControlKey
                CurrBtn.Text = "CTRL"
            Case Keys.A To Keys.Z
                CurrBtn.Text = Chr(e.KeyCode)
        End Select

        CurrBtn = Nothing

    End Sub

    Private Sub Button_Click(sender As System.Object, e As System.EventArgs)

        Dim btn As Button = sender

        If btn.Text = "" Then
            CurrBtn = btn
        End If

    End Sub

End Class

Precondition - all the buttons you want to dynamically assign must have the Text property set to the null string initially. The form load sub attaches the same handler to all blank buttons. CurrBtn allows you too select a button then activate it by pressing a key. You may also want to provide visual feedback by changing the button colour while it is active.

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

Responsiveness isn't just giving you what you want. Or are you 3 years old and think that people should just give in to all your demands?

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

I'm not sure if that was sarcasm or not. In the early days of personal computers the "next big thing" was "user friendly" software. Most software companies accomplished this merely by stamping "USER FRIENDLY" on their existing software. My point is that changes do not make a product or service "much simpler" just because the vendor says it is. perhaps Google+ is actually much simpler. I never used it before and I don't plan on using it in the future. Microsoft tried to tell us that windows 8 was a giant step forward in usability. Maybe if your only device was a touch based tablet. Not so much for the rest of us.

rproffitt commented: I own a Windows 8 tablet. Not a fan. Maybe I should start a thread on why. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Finder is slightly useful, but there is better way to do it.

What would a better way be? I was taught that when I go to my boss with a problem I should have a solution in mind.

Hiding it in a NOT so obvious tiny little icon is not great navigation experience.

So many programs are using the hamburger/waffle icon that its function should be obvious by now.

Yeah that's what I would like to see, some way to more openly say "here's C#", or "here's Java".

You can add /tags/vb.net or /tags/java to get direct access via the address bar. I have a shortcut to take me directly to the vb.net tagged articles.

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

How about putting the controls you want to show/hide as a set into a groupbox. Then you can just make the groupbox visible or not to show/hide all of the controls in it.

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

For SqlCommand you can't use ? for parameters. Replace it with @badge as in

query = "SELECT [Surname], [OtherNames], [NRC], [DOB] " & " FROM tblEmployees " & " WHERE EmpNo =@badge"
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's actually less trouble to just show you the code than it is to chastize you for not showing any effort to solve it yourself ^_^.

Dim myFiles As New List(Of String)

For Each file As String In My.Computer.FileSystem.GetFiles("D:\temp")
    myFiles.Add(file)
Next

Dim rnd As New Random
MsgBox(myFiles(rnd.Next(0, myFiles.Count)))

What do you know. I was able to do both. I don't know of any vb.net book that doesn't cover these beginner level techniques.

rproffitt commented: +1 +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you can cable in to the router then you can get the password from the admin interface. Or you can ask whomever maintains the router for the password.

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

I'm still not getting through here. What you are suggesting is a way to create variables

prop001
prop002
prop003
.
.
.

What I am saying is that what you really want is

prop(1)
prop(2)
prop(3)
.
.
.

You want to declare a variable number of variables dynamically which, in most cases, is just bad programming. All of the variables you want to create are closely related. They are all of the same type and differ only in value. Yes, you can create certain types of variables dynamically - objects, but not the simple types like strings, integers, etc. In vbScript you can use ExecuteGlobal to do this. While there may be a way to do this in vb.net I am not aware of it and wouldn't recommend it even if I was.

One suggestion was to create a variable length array and use ReDim Preserve as needed. I would also not recommend this. It's clumsy and slow. Lists and Dictionaries are much more flexible and easier to use. If you want to post a small version of the file you are processing perhaps your intentions will be clearer and I can provide a code snippet to illustrate what I am saying.

Teme64 commented: Not 120 variables for 120 values but 1 variable (array) for 120 values. This is the correct approach +11
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The simplest definition of a forum is "a place for discussion." If DaniWeb doesn't qualify for that then I don't know what would.

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

There is one new user who seems to always include the text

Bold Text Here

in every post. I think I see why. Try this.

  1. Create a new thread
  2. Type a title
  3. Type a tag or two
  4. After the last tag, press Enter

The cursor will be located to the text box and the Bold Text Here will be automatically inserted. Any way this can be prevented? Perhaps wnen the focus is on the Tags edit box, Enter can be made to default to Add Tag.

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

Unfortunately, it's not just a question of being able to prove ownership. It's also being able to afford to prove ownership. If someone with deep pockets wants it then they can just tie you up in litigation until you are broke. That's why I think that once you've posted the code (the algorithm) you can pretty much say goodbye to ownership.

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

At some point the people/person asking for the conversion will almost certainly come to you with a statement that begins with "As long as you are rewriting it you might as well...". This is known as scope creep. They will assume that as long as you are rewriting it will take zero (or minimal) extra effort to add features. If your response is

No problem

then you may safely consider yourself a moron. Instead, your response should be to state that the specification was frozen at the time you accepted the conversion project. Any requested changes would immediately render that contract null and void. If the changes are truly minimal they can be made at the end of the project and classified as a new project. Once you accept changes to an existing project you will be repeatedly asked to make further changes. Any failure of the project/missing of deadlines will then be on your head.

I've been there.

ddanbe commented: O so true! Been there too. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I just think that it's a tad unfair to tell people after the fact to read the rules when they are buried in the TOS. At least when there was a direct link labeled Rules there was something to throw back at them.

dtpp commented: +1 for this +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Perhaps one or both of you could add a blocking rule to your respective firewalls or a HOSTS entry to redirect to 127.0.0.1

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

In other words, every time you shuffle a deck of cards you almost certainly have created an ordering which has never existed in the universe before.

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

Maybe it's what a bro might ask another bro? As in

S'up playa?

nullptr commented: yo! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Deforestation in the Amazon has dropped by 80% since 2004. Source

Stuugie commented: I absolutely love this, Good on Brazil for standing up and protecting their precious land! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Create a ProgressBar named prgFileCopy and set

prgFileCopy.Minimum = 0

Calculate the number of files to be copied and assign that as

prgFileCopy.Maximum = numFiles

Start by setting

prgFileCopy.Value = 0

and after each file copy has completed (in the loop) do

prgFileCopy.Value += 1

You might want to dock the prgFilecopy to the bottom of the form.

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

Pretty much. Even though I am comfortable with editing the registry I still prefer to make mods by creating .reg text files and using them to add/edit/remove entries. And, of course, I do full disk images so if I do accidentally brick my system I can just reload the last good image.

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

Try deleting them and you'll find out.

overwraith commented: That is hilarious... +3
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Some of us (especially the dinosaurs) have to be dragged, kicking and screaming into the future. I was put off by the sudden change to the new UI but with the incremental changes since then I have really come to like the new layout and organization.

I'm a little late in saying thiis Dani but nice job.

Dani commented: Thanks! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I won't be changing (not going to use the term, upgrading) to Windows 10 anytime soon. I don't see anything that it offers that I don't get under Windows 7.

dtpp commented: MetroUI-like interface..... +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

"Unacceptable" kind of sounds like you are demanding that she change it. Are you really sure that is the tone you are going for? Perhaps you might like to rephrase.

dtpp commented: Im 'demanding' nothing as Im not owner of DaniWeb. I may be suggesting, but not demanding..... +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And yet <M> still has credit for self-endorsing. (c'mon. You had to know I'd say that).

But I'm not bitter ^_^

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

IMO it's better at the top but if you remember your Ricky Nelson (Garden Party)

You can't play everone so,
You got to please yourself.

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

Especially those of us who are doing the most complaining ^_^

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

As I understand it, I can add a tag when I create a thread but the creation of a tag is not mandatory. When someone posts a new vb.net question and does not create a vb.net tag then how am I to know about it when I have to select vb.net to look at vb.net related posts?

And I have asked this before, but since Search does not allow me to do a tag-based search, how do I look at posts which contain tags that do not appear in the tag list? All in all I think that either the implementation or the explanation of the tagging system has been poorly handled.

Likewise with some of the UI changes. The highlighting of message headers to indicate unread is good (but not intuitiive) but unless I have my contrast turned up and the screen angle just right I do not see the highlight. The overlay icon that shows that I have posted in a thread is also very hard to see and non-intuitive. I think that making these changes and not explaining them was a mistake.

dtpp commented: it definitely was a huge mistake..... +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

So how do I get to them now?

Ah. I select Programming, scroll waaaaaaay down to the bottom of the page and click vb.net. How, exactly, is this an improvement?

zachattack05 commented: Agree. +0
dtpp commented: +1 +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

All of the forums under Programming and Digital Media seem to have vanished.

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

I find the new format uncomfortable. I would prefer to see the contributor's name at the top of the post and I think there is too much space devoted to the user details on each post. I'm not particularly enjoying browsing the forums anymore. If you insist on keeping the signature stuff at the end of the post, how about changing the header from

14 hours ago

to

14 hours ago by pritaeas

It wouldn't take space away from anything else and still provide useful information.

I still think there is way too much space devoted to Related Articles. I don't see why this has to take up 2/5 of the screen. And the social media icons are way oversized.

Dani commented: I will consider this :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Every line that is indented by at least four spaces will be posted as code so you don't actually need the code tool to post code. When the cursor is in any part of a line, pressing the tab key will indent the entire line. Shift-tab will outdent it. Selecting multiple lines allows you to in/outdent multiple lines at once.

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

I found a bug in the PL/1 compiler (verified by my professor) that caused me to had in an incomplete project. I spent two days trying to figure out what I was doing wrong until I finally approached my professor.

Anyone remember PL/1?

Slavi commented: It's actually still being used lol, there's a bank in Denmark looking for developers cos their mainframe is in PL1 xD +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you declare class level integers nextRow and nextCol you can generate a new randow row and column by

Private Sub btnNumber_Click(sender As System.Object, e As System.EventArgs) Handles btnNumber.Click

    Dim rnd As New Random()
    Dim clicked As Boolean = True

    Do While clicked
        nextRow = rnd.Next(0, 4)
        nextCol = rnd.Next(0, 4)
        clicked = Grid(nextRow, nextCol).BackColor = Color.Red
        Me.Text = nextRow & "," & nextCol
    Loop

End Sub

The loop generates new pairs until it finds a pair for a cell that has not yet been clicked. You can modify the grid click handler to flip the colours only if the correct cell was clicked. You could even add

btnNumber.PerformClick()

as the last line in the grid click handler to automatically generate the next random pair.

By the way, Microsoft, for some insane reason, decided that the Next method would generate a random number which is greater than or equal to the lower bound but only less than the upper bound. This is a completely brain dead decision (IMHO). Thus rnd.Next(0,4) generates a number from 0 to 3.

Dark_1 commented: It's working... Thanks a lot... :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not sure I follow the logic but I'm going to offer a suggestion to see if that simplifies things. The user is expected to click on a textbox and "Click" is not an event associated with a textbox. It's more of a button thing. My suggestion is to create the grid at runtime and make it a grid of buttons. The buttons can be accessed through an array by the row and column numbers (0-3). Buttons, like textboxes, can have text and you can also change the colour.

Public Class Form1

    Private Grid(3, 3) As Button
    Private btnSize As Integer = 25
    Private btnPosn As New Point(10, 10)

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

        CreateGrid()

    End Sub

    Private Sub CreateGrid()

        'Create a 4x4 grid of buttons with a common event handler. References
        'to the buttons are stored in "Grid" for easy access. The row and
        'column numbers are stored in the button tags to differentiate the
        'individual buttons in the click handler.

        For row As Integer = 0 To 3
            For col As Integer = 0 To 3
                Dim xpos As Integer = btnPosn.X + btnSize * col
                Dim ypos As Integer = btnPosn.Y + btnSize * row
                Dim btn As New Button()
                btn.Tag = {row, col}
                btn.Location = New Point(xpos, ypos)
                btn.Size = New Size(btnSize, btnSize)
                AddHandler btn.Click, AddressOf Grid_Click
                Me.Controls.Add(btn)
                Grid(row, col) = btn
            Next
        Next

    End Sub

    Private Sub Grid_Click(sender As System.Object, e As System.EventArgs)

        Dim btn As Button = sender …
Dark_1 commented: Actually It should be able to press only the number specified in the Random Generator. If he clicked the right one colour changes if else no change +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

@Sanu - note that Me.Controls("CheckBox" & i) will directly reference the control (but it has to be cast to CheckBox first).

@fugio - you have two examples here that do what you seeem to be asking. If you don't understand something specific please ask instead of just posting code.

Santanu.Das commented: Thanks for pointing out an unnecessary loop of controls. +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could try to recover the product key using this utility

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

I was having trouble deciding whether to post this here (because it's about grammar) or in AD's thread (because it's a joke). I decided to post it here.

A "proper" Boston lady goes into a restaurant down south. When she places her order, the waitress notices her Bahston accent and asks, "Where y'all from?"

The woman answers, snottily, "I'm from where we don't end sentences with a preposition."

The waitress reflects for a moment, then says, "In that case, where y'all from, bitch?"

Stuugie commented: lol +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I didn't want to start a new thread for this bu, Dani - you might not be surprised by this. Google is being sued for skewing search results.

The claim not only alleges that Google favors its own products over competitors' - even when the others are more popular - but also that the sponsored links shown on the search engine are heavily skewed by the amount of money paid to Google. For example, Moneycontrol.com is supposedly more popular in India than Google Finance and, yet, the latter is shown earlier on in the search results. Flipkart even went on to say that the position of its site in search results directly correlates with its advertisement spending.

Full article

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

What format is your email in? What program did you use on the old laptop? For Outlook you can just copy the PST. For Thunderbird, the entire profile folder.

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

I think its not rude, its truth being told in straightforward way.

So, hypothetically, if you make a statement that is contradicted by the facts and I respond with

You are an idiot if you believe that because...

instead of something like

that turns out not to be the case because...

in your opinion my first statement is not rude because I am being straightforward. I'm afraid I'm going to have to disagree with you on that one. Good luck trying to get people to see your side of anything with that attitude. When people hear themselves or their ideas called "stupid", "idiotic", etc. they immediately get defensive instead of being open to suggestions or constructive criticism.

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

OK. Then the obvious next question is - what is the type of the database field named playerid. I had assumed it was numeric based on the single example. Please note that I have asked you three times to post the actual query (the value of cmd.CommandText) and you still haven't done that.

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

We really need an emoticon for sarcasm.

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

Like I said, this entire project is only a few weeks old. I came up with the idea 3 weeks ago, started developing it 2 weeks ago, and launched it over this past weekend.

Every other piece of software I have ever bought/downloaded has been 100% bug free and exactly what I wanted with every feature exactly how I would have designed it myself. Shame on you for not releasing a perfect and highly polished product that measures up to everyone's standards.

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

It is one thing to point out perceived shortcomings of someone else's work. It's another entrely to get personal. I'm always in favour of rational and constructive criticism. However, referring to a feature, or lack of one as "stupid" is not rational or constructive. It is just rude. I can only assume you have never read the Daniweb rules, particularly the one stating keep it pleasant. Criticize the product, not the person.

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

I should also point out that I do allow for people to whom English is a second language. But for people who know only English I expect better. I suppose it affects me in a similar way as when I see some moron who walks around with his pants halfway down his a$$. You can dress better. You choose not to. I've seen people with multiple facial piercings show up for a job interview. Their attitude seems to be "If you can't accept me for who I am then that's your problem". I disagree. If I make assumptions about you based on your appearance (or how you speak) and that costs you your chance at a job then that's your problem.

@ddanbe - I have a great deal of respect for people who have taken the time to learn a second language. I have tried to learn French but, lacking the opportunity to practice (or perhaps my poor brain is just too old) I was never able to develop any proficiency.

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

I present myself to the world in four ways

  1. how I speak
  2. how I act
  3. how I write
  4. how I dress

How I speak and write are a function of form and content. When I meet someone for the first time and see a person who is dressed well and acts respectful (in terms of possibly posture, body language, etc.) I form an immediate opinion (although one subject to change). If that person then opens his mouth and says something like, " Me and Dave were at the pub and Dave axed me.." my opinion is immediately revised to "here is a person who does not care how the rest of the world sees him". It may be unfair but I immediately discount any opinion from that person as being uninformed and uneducated.

First impressions may be unfair but you only get one chance to make one.

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

Actually, my wife and I have had some of our most productive "relationship" discussions by written letter. And those were while we were in the same house. We still are, in case that last sentence left you wondering. The nice thing about the written argument/discussion is that nothing gets said in the heat of the moment. And if you save the letters there is never any disagreement over who said what later on.

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

In 29 years at my former place of business (approx 5000 employees) I've seen two times when consultants came in to administer personality tests. Each time we were given a fancy pop-up card with a colourful graph to display on our desks for the dubious benefit of promoting better interaction with others. Management eventually saw these tests for what they really are - a pseudo-scientific scam to separate corporations from their money.

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

ARS Technica reports that Windows 10 still sends info to Microsoft even when specifically told not to. Some services apparently connect to Microsoft's servers through unencrypted channels, possibly allowing the interception of download traffic.