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

The only problems I have had are with drivers for an old Lexmark printer and a Plextor USB TV tuner. I do not agree that XP is "so much better to use". I don't expect vendors to release drivers for all of the hardware for all future versions of Windows.

Tcll commented: good point, and I agree +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I still use Office 2003. The newer versions all have "the ribbon" which I hate passionately.

Tcll commented: I know that feel +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You might try strings.exe from the free Sysinternals Suite. This may allow you to recover all/most/some of the text.

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

At least for today, my favourite word is "banned".

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

If the database is in the same place (GEN-PC) and the other computer has access rights then you shouldn't have to change the connection string.

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

Here's an example. I created a blank form, added a picturebox, then added a label at the centre of the picturebox. Note that even though the label is over the picturebox, it is actually containied in Me.Controls. In the following code, only the line that has the comment "run time" actually has to be in the code. The other three lines set properties that can be set in the designer. This code gets executed when the form loads and does not require that you click on anything.

Public Class Form1    

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

        Me.BackColor = Color.Azure             'design time
        PictureBox1.BackColor = Color.Coral    'design time
        Label1.BackColor = Color.Transparent   'design time
        Label1.Parent = PictureBox1            'run time

    End Sub

End Class

Your problem was that when you double clicked on the picturebox in the designer it automatically created a handler for PictureBox1_Click. That is where you added your code and that is why you had to click on the control to execute that code at run time.

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

The hyoid bone is the only bone in the human body that is not connected to any other bone.

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

It makes a nice companion site for 99 bottles of beer on the wall

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

My e-reader (on the laptop) allows me to add "sticky" notes. Having my computer reference books in eform allows me to use Search to find things more easily. Also, if I have to help a friend I can just load up my reference books on a USB stick and tote it along, or even take along the laptop.

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

Just because you do

Dim txt As TextBox = Me.Controls(name)

doesn't mean that txt is set to an existing object. If name doesn't exist then txt will be set to nothing and you will get the error. I suspect you are not creating the control name properly. Print out the control name using Debug.WriteLine before you try to retrieve it and that will tell you the name of the (non-existing) control that is causing the error.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
 CURTIME([fsp])

As of MySQL 5.6.4, if the fsp argument is given to specify a fractional seconds precision from 0 to 6, the return value includes a fractional seconds part of that many digits. Before 5.6.4, any argument is ignored.

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

In MS SQL you can do

SELECT TOP 5 * FROM myTable ORDER BY NEWID()

I believe MySQL has this feature as well. NEWID() generates a globally unique identifier (GUID) in memory for each row. By definition, the GUID is unique and fairly random.

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

A travelling salesman drives into a farmer's yard. As he gets out of the car, he notices a three-legged pig walking through the lawn. When the farmer comes out to greet him, the salesman says "I wanted to show you our latest catalog, but I couldn't help noticing you have a three-legged pig."

The farmer replies, "let me tell you about that pig. Last fall I was ploughing the north forty when the back wheels got stuck in the mud. The tractor flipped and pinned me underneath. I woulda died for sure but that pig saw what happened, ran back to the house and squealed until my wife came outside. She came and found me under the tractor and called for help. That pig saved my life."

The salesman says, "great story, but why does he only have three legs?"

"Let me tell you about that great pig", the farmer says again. "Just this spring we all went to bed early. My wife forgot to turn off the stove and when a breeze blew the curtains over the stove they caught fire. That pig smelled the smoke and squealed until we all woke up. We put out the fire and saved the house. That pig saved all our lives."

One more time the salesman says "yeah, but why does he have three legs?"

The farmer replies, "hey, a great pig like that you don't want to eat all at once."

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

"Action figure" is only a marketing term used to sell dolls to boys.

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

While this may show how to use the classes you have developed I think it falls far short of a Daniweb tutorial because it doesn't actually teach anything. First of all, the code appears elsewhere which means we have to rely on the content always being available on an external (to Daniweb) server. Next, there is an almost complete lack of comments.

You started out by stating

Have you ever wanted to develop a math parser and evaluator?

At best what you have provided is a black box with an example of how to call it.

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

Try running it in a command prompt as Administrator.

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

While declared atheists make upward of 15 percent of the U.S. population, they only make up 0.2 percent of the prison population.

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

An alternate quote is - when I hear someone say "I'm not book smart, but I'm street smart", what I hear is "I'm not real smart, but I'm imaginary smart".

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

Here's an interesting article on pronounciation errors and the evolution of language.

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

octal 31 = decimal 25

reminds me of the anagram

eleven plus two = twelve plus one

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

A platform to tell the world that you just went to the toilet

It's been done. See here.

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

Too many ads.

Too little privacy.

Too high a ratio of crap to content.

It takes away from actual (as opposed to perceived) friendship and contact.

Maintaining a Facebook page has become a chore. Documenting your life has become more important than living it.

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

Oh wah ta na Siam.

Mozart's canon, Difficile Lectu" contained the phrase "lectu mihi mars" which was intended to be heard as "Leck du mich im Arsch", which in English would be "kiss my a$$". link

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

This one's for Mike...

In Quebec, Canada, there is a fastfood poutine restaurant where the price of the poutine decreases in winter as the temperature gets colder. link

mike_2000_17 commented: lol, I ate there many times! Best poutine in Qc! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you took all the people who slept in church and laid them end to end they'd be a lot more comfortable.

Can we get off the guns now?

diafol commented: heh - took me a while +0
GrimJack commented: snort +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This Arlo and Janis cartoon nails it.

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

@mike said

one of the primary uses for firearms is to commit suicide

@jwenting said

You claimed the main reason people buy guns for is to commit suicide

Regardless of whether mike's statement is true or not, deliberately misstating what he said, then refuting your interpretation of that is not a valid argument.

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

Lest you think I've got nothing better to do than rag on the gun nuts...

Over the past 50 years, gun owners have been responsible for over $2 billion in wildlife conservation in the United States due to 10% tax on guns and ammo. link

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

they screwed up networking with home-groups

That's one of the reasons I stick with the Pro version of all of the Windows releases. It gives me more networking options.

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

These are technically not grammar issues but...

You should use "less" when talking about non-discrete quantities, and "fewer" when talking about discrete quantities. For example:
  1. This line is for 12 items or fewer.
  2. There were fewer than 20 people at the party.
  3. We have less than 3 days to complete the coding.
  4. I haven't weighed less than 200 pounds since I turned 50.

In the first two examples the units are discrete. You would never say there were 17.5 people at the party. In the last two, the units are non-discrete as you could conceivably say that you had 3.5 days to complete the coding.

"Since" refers to time. "Because" refers to reason.

In example 4 (above), since is correct because it refers to a time. However, instead of saying

Since I was in the neighbourhood, I thought I'd drop in.

You should say

Because I was in the neighbourhood, I thought I'd drop in.

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

I'm hoping that people will post unusual or little known facts here. It would be proper to include a link to a source for confirmation. Here's a start.

Speedy Gonzales was banned by the Cartoon Network for being an offensive stereotype, only to be returned after mass protest by the Hispanic-American community. link

Dani commented: Wow, this thread really took off :) +0
RikTelner commented: If this wasn't DaniWeb, I would've thought that everybody is now seeking attention of Dani by posting comments by upvotes. +0
<M/> commented: oh yeah it did +0
almostbob commented: Thanks, this thread is a blast +0
RobertHDD commented: Yah Very good jim +0
XP78USER commented: IT GETS BETTA AND BETTA!!! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If your Excel spreadsheet is laid out as regular columns and rows with a header row that identifies the columns then this code will allow you to read the data using ADODB the same way you would read records from a database table. To try this code

  1. Create a new project
  2. Add a ListBox control named ListBox1
  3. Add a project reference to adodb
  4. Replace the project code with the snippet code

To create a test Excel spreadsheet just download the attached test.zip and unzip it. The file, test.xls contains a table of authors, books and a few extra columns. Make sure to modify the string, file to reflect the location of where you saved test.xls.

If your spreadsheet does not contain a header row then you can use the following

con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.ConnectionString = "Data Source=" & file & ";Extended Properties=""Excel 8.0;HDR=NO"""

Note the use of double-double quotes for the Extended Properties in order to account for two extended properties separated by a semicolon. You will also notice in your output that if you do not use a header row, your field names will be F1, F2, etc.

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

@oussama - How long did it take you to unravel that?

For expressions that already evaluate to Boolean there is no need to do the comparison so

If q.Created = True Then

can be written as

If q.Created Then
oussama_1 commented: got it, thanks +3
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

SQL queries return sets. You issue the query then wait for the response. There is no loop into which you can embed a progress bar update. Doing a SELECT COUNT to get the actual number of rows, then executing the query to get the data is a bad idea. The server has to process the tables to get the record count, then again to get the records. That makes your application half as responsive and puts an unnecessary burden on the DB server which could impact performance for other users.

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

Also, in terms of most sci-fi, why if you have a military space ship do you equip it with a brilliant white gleaming hull so it shows up beautifully?

Why would any colour show up in space? Between stars there is not a whole lot of light. And if you are close enough for a visual then your sensors would long ago have registered the ship anyway.

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

I did this

Dim key As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{002568CE-7595-46A3-A1C1-53F41A4ADC34}"
Dim regKey As RegistryKey = Registry.LocalMachine.OpenSubKey(key, False)

If regKey Is Nothing Then
    MsgBox("Registry key does not exist!")
Else
    MsgBox("Registry key exists.")
End If

on my system (Windows 7 Pro) and it worked just fine. Note that I used False as the second parameter to avoid a System Security Exception.

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

I presume no is classNo. This doesn't appear in either of the two tables so you would have to generate it in the query as in

INSERT INTO classroom
SELECT 1 AS classNO, lname, fname FROM table1 
UNION 
SELECT 1 AS classNO, lname, fname FROM table2

However, the new table will give you no way to determine who is a student and who is faculty.

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

What is the layout of the new table? There is always a way to combine tables. The trick is to combine them in a way that makes sense. If you just want a table of people regardless of whether the people are students or faculty then you could

SELECT * FROM table1 
UNION 
SELECT * FROM table2

If you want to include a field that distinguishes between faculty and students you could do

SELECT 'S' AS classID,* FROM table1
UNION
SELECT 'F' AS classID,* FROM table2

which will return the fields classID, lname, fname and age where classID=S indicates a student and classID=F indicates faculty. If you want to insert the records inito a new table then add

INSERT INTO table3

at the start of the query.

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

That was a mistake on my part. I meant to downvote the OP. I have reversed the error (I hope). Sorry about that.

rubberman commented: Stupid keyboard! :-) +12
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Those macros are obscene and should never be used in code that anyone else ever has to work with. They may make the code shorter but they obscure its meaning. They also use variables that are not passed to the macro. Blecch!

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

That's not code. That's just a string. Please show us your code and include the error message (if any) and the line causing it.

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

In your earlier post you had

cmd.CommandText = "INSERT INTO Resident(ResidentNo, Residential, Street, Telephone, LName, FName, MName, Gender, Birthday, Age, CivilStatus, Religion, Education, Profession, Salary) " _
            & ("VALUES @ResidentNo, @Residential, @Street, @Telephone, @LName, @FName, @MName, @Gender, @Birthday, @Age, @CivilStatus, @Religion, @Education, @Profession, @Salary")

The actual string created is

INSERT INTO Resident(ResidentNo, Residential, Street, Telephone, LName, FName, MName, Gender, Birthday, Age, CivilStatus, Religion, Education, Profession, Salary) VALUES @ResidentNo, @Residential, @Street, @Telephone, @LName, @FName, @MName, @Gender, @Birthday, @Age, @CivilStatus, @Religion, @Education, @Profession, @Salary

You can see that you are missing the parentheses around the values. The format is

INSERT INTO tablename (field, field,...) VALUES(value, value,...)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It depends on the intent of the person who is relating the story. For example, my wife may have spent ten minutes in her head thinking about Mary and the dumb things she says. If she then starts telling me the story, "she" would refer to Mary, although I would have no way of knowing that. I've learned this from direct experience. Likewise when someone says "I ain't got no money." Grammatically this means they do have money but the intention is to say "I have no money."

ddanbe commented: direct experience...sounds familiar +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I expect that part of my problem with incorrect grammar stems from mild OCD. I may have said this earlier but it bears repeating. I may have said this earlier but it bears repeating (not funny?). Some also comes from my background as a programmer. Years ago I introduced a bug when I inadvertantly skipped one comma in a FORTRAN call to an assembler routine. The call looked something like

CALL SOMEFUNC(parm,parm, parm, parm,,,,,,,,,,,,,,,,,,,parm)

except the actual line of code was spread over two lines. The missing comma caused the last value to be passed as the wrong argument and the assembler routine (poorly written) did no validation for the number of arguments. It took two weeks to track down. There are similar cases in written text where misplacing one comma, or omitting it entirely can change the meaning entirely. A (contrived) example is

No parking is allowed.
No, parking is allowed.

Then there are problems with ambiguity as in

Mary and Stephanie were at the mall when she said ...

I come across this frequently in conversation where the person speaking is well aware of who "she" refers to, but none of the listeners do.

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

You should put single quotes around string (character) values and not around numeric values. You didn't include your field definitions for the database table so we can't tell which values are which. For example,

INSERT INTO myTable (idnum) VALUES('123')

where idnum is defined as INT may cause a problem because the actual value you are passing is a string, not a number. It should be

INSERT INTO myTable (idnum) VALUES(123)

In any case, you should be using parameterized queries which would not only handle that for you but also prevent against SQL injection attacks. Please see the example here.

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

You can create a dictionary to hold the keywords and definitions.

Dim Words As New Dictionary(Of String, String)

The key is the word and the value is the definition. Then create a list from just the words. To randomize the list in the display you can

do while the list isn't empty
    generate a random number from 0 to list.Count - 1
    copy that list element to the display
    delete that list element
loop
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have always suspected that "till" was actually the older version of "until"

I can always rely on Mike to "root" out the truth.

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

If you use proper indentation then the solution becomes more obvious.

Dim decCharges As Decimal
Dim intHours As Integer

Const decA As Decimal = 9.95D
Const decB As Decimal = 14.95D
Const decC As Decimal = 19.95D

inthours = CInt(txtHours.Text)

If radA.Checked = True Then
    If intHours >= 10 Then
        decCharges = decA
    Else
        If intHours < 10 And intHours > 744 Then
            decCharges = intHours * 2
        End If
    End If

    If radB.Checked = True Then
        If intHours >= 20 Then
            decCharges = decB
        Else
            If intHours < 10 And intHours > 744 Then
                decCharges = intHours * 2
            End If
        End If
    End If

End If

If radC.Checked = True Then
    If intHours >= 744 Then
        decCharges = decC
    End If
End If

lblTotal.Text = decCharges.ToString("c")

You should not introduce so many blank lines. It reduces the number of lines of code that are visible at one time. Use just enough to form logical groupings of code. You could also use the Select Case True form to improve readability and structure even more. In that case you get

Dim decCharges As Decimal
Dim intHours As Integer

Const decA As Decimal = 9.95D
Const decB As Decimal = 14.95D
Const decC As Decimal = 19.95D

intHours = CInt(txtHours.Text)

Select Case True

    Case radA.Checked

        If intHours >= 10 Then
            decCharges = decA
        Else
            If intHours < 10 And intHours > 744 Then
                decCharges = intHours * 2
            End If
        End If

    Case radB.Checked

        If intHours >= 20 …
Stuugie commented: I wish all used proper indentation. +5
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I hate the concept of "reality" shows because they do not, in any way, reflect reality. These shows are cast(ed) based on lists of character types. Let's see, we need a villain, a bitch, a lazy black guy and an entitled black woman (note the pandering to stereotypes that help to reinforce racism), a nerd and a hunk. We also need a blond with fake boobs, and don't forget the gay guy. And if he's queer as well as gay then so much the better. These shows glorify and promote bad behaviour. They promote the idea that there is no difference between fame and infamy and that bad behaviour gets rewarded. Snookie got her chops busted by being obnoxious to a drunk guy in a bar. That's what happens in the "real" world.

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

please neither make fun nor disgrace people of countries who are trying to make english language as one of their favourite

I have a lot of respect for people who have gone to the trouble of learning a second language. I don't believe I have ever mocked anyone for making an honest effort to communicate in their second language. As stuugie says, that is reserved for primary English speakers who do not even make a mimimal effort to communicate.

Stuugie commented: mlk3.mca wants me to teach him/her proper grammar and tenses. I had to politely say no. He/she is taking this way too personally. +0