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

He got banned a while back for too many infractions but I see that the infractions have expired. I guess he didn't care to return.

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

It was not an unfortunate slip. It was also not a deliberate dig. I spent some time in Montreal many years ago. I struggled with my (admittedly poor) high school French and (I presume) the people I met appreciated the effort and responded kindly. I didn't meet a single person that I didn't like. I don't believe that cultures should be assimilated. I also don't believe that any culture should be elevated to "special" or "distinct" status.

is the province of Québec just a big cultural ghetto

I seem to have hit a sore spot. Those are your words, not mine. Don't try to claim that as my intentions.

Québécois people didn't "come to Canada"

Yes, you did. Just a lot longer ago than my ancestors. Even the first nations people "came" here from somewhere else.

we won't become "Canadian" anymore than you would become American

You say that as if being Canadian is somehow distasteful. What does it mean to you to become "Canadian" as opposed to Quebecois? I'm not trying to start an argument. I really would like to know. No one has ever taken the time to explain it to me.

and occupied

Could you please expand on that? I'm not sure what you mean.

I love my neighbors (south and west), but that's a long way from assimilation

Again, I have no desire to see the various cultures assimilated. I believe I made that clear. It's …

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

-45C with wind chill this morning. But it's been worse. This day in 1996 it dropped to -57.6C with wind chill.

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

I like the idea of having a variety of ethnicities. It makes the world a more interesting place. My only problem is when these groups want Canadian law to change to address their differences. Some groups demand that the laws of their homeland take precedence over Canadian law. Sorry. If you were so enamoured of the laws where you came from and you want to keep them over Canadian laws then you should have stayed home. I don't like the idea of French-Canadian, Japanese-Canadian, etc. Once you come here then you are Canadian. Period. Celebrate your roots but don't use your roots to insulate your group from the rest of society or to demand special status.

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

No problem. Glad we got it straightened out.

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

If you want to speed things up then do something like

ListView1.SuspendLayout
'put the loop here to update the listview
ListView1.ResumeLayout

This will stop the display of the listview from redrawing until all of the items have been processed instead of once for each change. It could make a huge difference to the performance. In order to give visual feedback to the user you might have a label that indicates something like

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

That's clearer. I thought you were still trying to assign a name to the StopWatch object. If you are creating all of the panels at the same time (ie in a loop inside a code block, then you can just use a local variable. If you are doing the creation at different times (ie different calls to a sub or function) then you will have to make the variable global. For the local case you get

for i = 1 to 5
    dim NextPanel as New Panel
    NextPanel.Name = "Panel" & i.Tostring()
    Me.Controls.Add(NextPanel)
next

for the global case you get

Public Form Form1

    Private panelnum As Integer = 0
    .
    .
    .

    Private Sub MySub()

        for i = 1 to 5
            panelnum += 1
            dim NextPanel as New Panel
            NextPanel.Name = "Panel" & panelnum.Tostring()
            Me.Controls.Add(NextPanel)
        next

Is that more what you had in mind?

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

It means you have five penalty points. If you accrue too many you are banned until they expire. I suggest you read the member rules the Keep It Pleasant section includes

  • Do not post insults or personal attacks aimed at another member
  • Do not use offensive or obscene language
  • Do not try to bypass the DaniWeb inappropriate language filter
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you have to ask, then start with the best protection for your level and use parameterized queries". Let the guy know that he isn't set for good if he uses this type of query.

You have to learn the basics before you get fancy but I think your suggestion is quite reasonable. It's a good idea to let them know there are more robust alternatives but for now they can...

And I'll add that having decades of experience doesn't make me an authority. Far from it. A lot of that experience is in very old technology. Or as my brother-in-law once said to a pompous uncle (much to the delight of his grown sons), "just because you're old doesn't mean you're smart".

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

First you add a FileSaveDialog object to your form by dragging and dropping from the toolbox. After you have done that, select the control and browse the properties. Each property has a description that explains what it is for. To prompt the user for a filename you do

If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
    MsgBox("you selected " & SaveFileDialog1.FileName)
End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are just looping through a listview then why do you need to exit the loop using a buttor or menu? Surely it will exit after all of the items have been processed. Mayybe you should post the code so we can make a more informed suggestion.

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

You can use regular expressions to step through every word. If you define a word as any string of one or more

  • lower case letter
  • upper case letter or
  • single quote

then to read a file and list all the words you can do

Dim text As String = My.Computer.FileSystem.ReadAllText(txtMyFile.Text)
Dim rex As New Regex("[a-z,A-Z,']+")

For Each m As Match In rex.Matches(text)
    Debug.WriteLine(m.Value)
Next

This will list all of the words, one per line. You should be able to check each word to see if it contains the substring. The expression, [a-z,A-Z,']+ matches one or more (the plus sign) of any combination of lower case letters (a-z), upper case letters (A-Z) or single quotes. I don't know if it is possible to have a word with more than one single quote, but it will match those as well. Note - you have to import System.Text.RegularExpressions

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Dim num1 As Integer
Dim num2 As Integer

If IsNumeric(txtNum1.Text) Then
    num1 = CInt(txtNum1.Text)
Else
    num1 = 0
End If    

If IsNumeric(txtNum2.Text) Then
    num2 = CInt(txtNum2.Text)
Else
    num2 = 0
End If

Or more concisely

Dim num1 As Integer = 0
If IsNumeric(txtNum1.Text) Then num1 = CInt(txtNum1.Text)
Dim num2 As Integer = 0
If IsNumeric(txtNum2.Text) Then num2 = CInt(txtNum2.Text)

You'll have to modify if the types are different, and you should limit the number of digits that can be entered to prevent overflow.

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

One more time about the Search feature. Please refer to this thread

I know you get most of your traffic from people being directed here via Google, but once those people are here and they want to do a search they are most likely to use the built-in Search feature which I have stated several times returns vastly different results then Google. If the built-in Search feature is so horribly flawed then why is it still present? Is there any way that the search string how to calculate working hours could be translated to how to calculate working hours vb and processed directly through Google as if the user had gone to Google directly? After all, I have no way of knowing if the user actually tried to use the built-in Search and got no results (as I do in Firefox) or not very helpful results (as I got in IE), or if the user just didn't bother. Perhaps this particular user has found Search to be of so little help that he/she just stopped bothering with it.

I know. I'm like a dog with a bone.

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

Phillipe provided five links to articles on this forum which give the help that was asked for, something that the OP could and should have done before asking the question. The phrase asking someone else to do the work for you refers not only to us providing the code but doing the search. I just called it like I saw it. If you browse the answers I have given on this forum you will see that I have provided very lengthy and detailed information in many cases. This was on my own time and own my own dime.

As for the abusive language (which you probably had to enter with the deliberate mis-spelling to get around the language filter), all that did was earn you an infraction.

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

If you have a block of code that is stuck in a very long loop that you want to exit prematurely then you'll need two things.

  1. a global condition that you can test to do an Exit
  2. a call to My.Application.DoEvents inside that loop

For example

Public Class Form1

    Private GetOut As Boolean
    .
    .
    .
    Private Sub MySub(...)
    .
    .
    .
        GetOut = False

        Do While some condition
            .
            .
            .
            If GetOut Then Exit Do
            .
            .
            .
            My.Application.DoEvents

        Loop

Then the code under (for example) btnEscape would include

GetOut = True

If you don't have the DoEvents call then your application will lock up.

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

Other thread

Dim NextPanelStopwatch As New Stopwatch

This thread

Dim Stopwatch As New Stopwatch ' <-- How can I assign the name [Stopwatch1]?

Both threads create a StopWatch object at runtime and in the last thread I explained that there is no Name property of the StopWatch object. How is that not a duplicate thread? You need to pay attention to the answer or state the question more clearly. You said How can I assign the name [Stopwatch1]?. What do you want to assign that name to?

If I am missing something obvious here I apologize but it's 02:25 AM and I'm more than a little tired from not sleeping.

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

Home sick in bed with a cold.

Bummer. I got a flu shot last October. Didn't keep me from getting the flu and a nasty case of bronchitis. Hope you are feeling better soon.

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

"Nice for the sake of nice" in that they weren't being nice because they wanted something. They were being nice because that is the way they they believe the world should operate - with people being considerate of each other.

Could it be that they all hated you and you only saw through some of them? :)

There are people who were nice to me only because they wanted something. I know that they didn't like me and I'll tell you why. Our control centre (province wide electric utility) has two networks. One is the control system which is used to run the several billions of dollars of electrical equipment (generating stations, converter stations, transmission lines, distribution stations/substations, tie-lines to other provinces/states). That system is totally isolated from the corporate network. My group maintained the servers/workstations for the corporate network in the same control centre. Any apps that went on that set of machines had to be cleared by us (which pretty much meant me) before they were allowd on the system. Engineering Systems was another group, in another building, that developed software that we maintained. My job (other than my duties as system maintainer, server admin, db admin, application developer, etc) was to ensure that these applications were robust enough (reliable enough) to be trusted in the target environment. Some of the apps dealt with inter-utility contracts for millions of dollars worth of power sales, optimization of all of the water in the rivers that fed the …

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

The StopWatch object does not have a name property. Please do not post duplicate threads.

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

Technically that not its name. That's just a reference to it. Consider

Dim sw1 As New StopWatch
Dim sw2 As StopWatch = sw1

sw1 and sw2 are both references to the same object but neither is the object's name. For most controls, Name is an actual property of the object (intrinsic). sw1 and sw2 exist separately from the object (extrinsic). When you destroy the object, sw1 and sw2 continue to exist.

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

It depends on the person. When someone does you a favour there is an unconscious desire (in most people) to reciprocate. There have been many studies of this particular phenomenon. The most recent one I read involved doctors and pharmaceutical reps. How many times have you been in a doctor's office and seen paraphenalia from drug companies? I've seen big wall calendars, desktop toys, pens, notepads, etc. Even though more extravagent gifts are seen as a bad thing, everyone turns a blind eye to the trinkets even though the studies have shown that the size (expense) of the gift doesn't matter.

Before I retired I knew which people at the office were "nice for the sake of nice" and those who were "nice to put me in their debt". Because I was conscious of this I was prepared for the inevitable "I have a favour to ask".

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

I don't disagree that parameterized queries DO prevent injections, but WILL they continue to?

Who knows? But that argument can be used for any security. We know anti-virus software protects us now but will it continue to do so? We know that firewalls protect us now but will they continue to do so?

We don't know each and possible vulnerability the tools we use have - or not until somebody cracks them.

That's the reason we don't develop vaccines for strains of flu that haven't shown up yet. Doesn't mean we shouldn't use the vaccines we have now. If we try to write software to guard against every conceivable threat (and those still not thought of) then the software becomes too expensive and too complex and takes far too long to develop.

Having said that I have two further comments. I got a flu shot last September and still got the flu and a nasty case of bronchitis. Bummer. Also, I am not advocating taking no precautions. I'm just saying we take all reasonable precautions. For most people asking questions on this forum I think parameterized queries fit the bill. Based on the perceived level of expertise of the posters (no insult intended) I suspect that if they don't know how properly phrase more than a simple query then complex field validations, stored procedures and database/domain permissions are probably beyond them.

Also, when I was a dbadmin/developer for our control centre I use complex field validations, …

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

We are amused.

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

The name is NextPanelStopwatch. To start it you do

NextPanelStopwatch.Start

Just make sure you declare it where it won't go out of scope.

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

With regard to multiculturalism - that's a myth. There is very poor integration in Britain as a whole.

I thought that was the definition of multiculturalism. Here in Winnipeg we have an annual festival called Folklorama where all of the different cultural groups in the City set up pavillions where people can come and sample the specific cuisine and entertainment (43 pavillions in 2012). When the different cultures get assimilated and lose their identities is when you don't have multiculturalism.

if you can somehow understand what they say... Cockney != English.

As revealed in Cockneys vs Zombies

trafalgars = zombies

Trafalgars
Trafalgar Square
fox and hare
hairy Greek
five day week
weak and feeble
pins and needles
needle and stitch
Abercrombie & Fitch
Abercrombie
zombies

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

Do you mean pronouns or do you mean proper nouns. In one case you want words like I, me, he, they, etc. This can be done by using a regular expression to identify the enumerated strings bounded by non-letters. However, if you mean proper nouns then I can't see how that can be done because it is impossible to build a list of all names to look for.

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

According to

parameterized queries DO prevent SQL injection attacks.

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

I suspect that as you are designing the log in form etc. you are probably in charge of what constitutes a username

But a single quote is a valid character in a name and because the example given was "John" I assume that actual names are being used. Using parameterized queries addresses the problem os embedded single quotes. A semi-colon is not a character that appears in a name.

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

Poor sod got banned from the BBC for it.

Too bad. It was an amusing story that makes a great point about language.

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

@diafol - I don't know if you've ever heard of the annual Just For Laughs Festival in Montreal, but Al Murray has been there and he was great. They broadcast segments of the festival on the DCBC and I was lucky enough to catch him.

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

Found him. Steve Hughes here and here

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

I remember seeing a stand-up comic and I wish I could remember his name. He did a bit on something related. He said you have the right to be offended by something but not the right to arbitrarily label something as offensive.

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

For a paid AV I can recommend Trend Micro. That's what my (pre-retirement) place of business uses for their 2000+ workstations/servers. Realizing that employees take work home, their licence also allowed employees to install it on their home computers.

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

But what if the username does contain a ' and it is valid, like O'Neal? In that case a parameterized query will handle it or you can use

txtUserName.Text.Replace("'","'').
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've heard the Brooklyn Bridge is also for sale. Has been for decades, mostly to tourists.

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

There is a big difference between spanking and assault. You can make one illegal and not the other.

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

Read Avoiding SQL Injection Attacks. It explains what parameterized queries are and how to use them.

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

You can also "shorten" it by putting several items on each line instead of one per.

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

I set up two laptops for relatives and I just put on Microsoft Security Essentials. I've read good reviews from several sources including Ask Leo and Windows Secrets.

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

It never occurred to him that his programming courses were trying teach him to be able to write the actual code himself

He probably heard the pie-in-the-sky promises of OOP about code reusability and took it to the extreme. Like the guy who wanted to close the patent office decades ago because everything had already been invented, he thought that all the useful code had already been written.

We're back to diafol's post in another thread. Too many people grew up having things handed to them instead of having to work for them. When it comes to actually putting in the effort they figure it's easier if someone else does the work for them.

I sometimes get a disparaging feeling that the coming generation (in high-school and undergrad today) has a bit of a generalized feeling that a lot of things (i.e., technologies) reside in black boxes labeled "magic" and it's forbidden to look inside.

When I was in my third year of University, homebrew computers were being sold at the Byte Shop and we had just received a Comemco (I think) 8080 based micro computer (yes, I'm that old). I wanted to see how the magic worked. The cover was off that sucker more often than not. My younger son had a course in how computers work at the micro-code level. He wasn't crazy about it but I would have loved it (even though I agreed with him that his professor was a major league …

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

@AD - thanks for providing the stats. Now back to the topic...

I find that 9 times out of 10 when I open the first door of a two-door entrance, the person I let through first reciprocates. As for motive, I find life complicated enough without worrying about motive. I'm not as concerned about why people behave the way they do as I am with the actual behaviour.

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

remove the editor box from threads that are too old and replace it with a message like the current one...

That sounds reasonable to me.

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

The more drug use we see the worse we are. Why do you think there is so much violence in America? Probably drug use has a lot to do with it. Dugs make people do things they wouldn't do otherwise.

So that's your logic?

more drugs = more violence
more guns  = less violence

Astounding!

By being chivarlous a man suggests he admires/agrees with those times and opinions

So If I get to the door first and hold it open for another man I am saying "You are inferior to me?" I don't think so.

I think it comes from us getting our idea of what the world is like from the media rather than talking to our neighbours

I agree there. The media likes to incite fear (remember H1N1?). Fear makes you "stay tuned for late breaking updates".

I also smiled at the fact that everyone is jumping on my statement of historical fact while ignoring my statement that chivalry is based on the view that women are frail, fragile, weak, and should be treated by men like a crystal vase.

According to several sources (the following from Wikipedia)...

Chivalry, or the chivalric code, is the traditional code of conduct associated with the medieval institution of knighthood. Chivalry arose from an idealized German custom. It was originally conceived of as an aristocratic warrior code — the term derives from the French term for horseman — involving honor, gallantry, and individual …

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

But I think people are being over-sensitive too

A lot of people go out of their way to find things that offend them and it's not enough to be personally offended. There are people who get offended on behalf of other people.

I got ### lickings when I was a kid and I grew up ok

Same here. My Dad spent many years on the local School Board. Occasionally the talk would turn to corporal punishment and someone would make a comment akin to "we must outlaw it lest we destroy children's lives, twist their minds, warp their spines, etc". My Dad's response was to ask who got spankings when they were young. All hands went up. The follow-up question was always, "who here is a warped, twisted individual as a result". No hands. Argument over.

I have to say I never got a spanking I didn't deserve. The worst punishment was when my mother would say "just wait until your father gets home". The waiting was worse than the punishment.

use of hard drugs (meth, coke, etc) are the downfall of any society

It's not the drugs. The drugs are a symptom and other countries with more relaxed drug laws have less of a drug problem. I can look up the stats later, but Americans have an inordinately large number of people in jail for minor drug offenses. Prison has a worse effect on most of these people than the actual drugs.

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

I am also brushing up on my German.

Because German is such a melodic language it induces relaxation. Take the word, "butterfly"

  • Spanish - mariposa
  • French - papillon
  • Italian - farfalla
  • German - Schmetterling

Or "I love you"

  • Spanish - Te amo
  • French - Je t'aime
  • Italian - Ti amo
  • German - Ich liebe dich

I can't speak German. I'm deficient in phlegm.

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

There is a property named AXVLC.VLCPlugin.Position that might be of use. I've never used the plugin but I noticed it while browsing the object.

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

The most common connections are

  1. ADO
  2. SqlClient
  3. OLEDB

ADO is the underlying connection behind both SqlClient and OLEDB but provides only basic functionality. SqlClient is used for connecting only to SQL databases but has the advantage of supporting named parameters (don't worry about that for now). OLEDB is the most generic (it can be used to connect to SQL, Access, Excel, CSV, etc) and also supports parameters (but not named ones). To connect to a data source you specify the connection information via a connection string which varies depending on the data source type and location. The web site I just linked to details many many sample connection strings.

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

Keep in mind that if you eliminate the column names then the values must be in the same order as the columns are defined in the table. If someone changes the column order then your query will puke or the data will go into the wrong fields. If someone adds a column (but not at the end of the table) then same problem. You are better off leaving the column names in. Also, you should be using parameterized queries to avoid SQL injection attacks.

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

I don't see a lot of "common" courtesy these days. Even in the great white north where we Canadians are supposed to have a reputation for being polite, manners seem to be disappearing. Noy in my family though, I'm happy to say. I think part of the reason that people these days are so "me" focused is the trend for the last few generations to teach children that they are special (in the better than everyone else sense). Two maky kids grow up feeling that the world should cater to them.

Old joke - how do two Canadians argue over a parking space?

"You take it", "Oh no, I insist, you take it..."