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

I'm not sure I understand. Classes shouldn't be using external variables. If you have a file which defines variables and they are used by multiple classes then you are making the inner workings of the classes dependent on external variables. If I've completely missed the point then please elaborate.

ddanbe commented: Modules should be eliminated from VB.NET +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Politics is the gentle art of getting votes from the poor and campaign funds from the rich, by promising to protect each from the other. - Oscar Ameringer

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

Any software that claims to boost your wifi speed is at best only a waste of money and at worst a scam to get you to install virus/trojan laden software.

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

Do you recall the definition of a "gaffe"? It's when a politician accidentally tells the truth.

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

I think you are missing my point. My point was that the crazies have hijacked one of your only two poiltical parties, and that party controls one of your two houses of government, and that party has effectively shut down the government. And the party that is in power (in name only) seems to feel that mass surveillance is a good idea.

I would be very concerned.

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

How the hell did you derive that from my statement?

Granted, making that connection was questionable, but I can see how one might be tempted to make it. I got the impression that you were OK with Cuccinelli wanting to outlaw oral sex simply because the reaction was pretty much ridicule and there was no chance of it becoming law. Doesn't it bother you that the officially sanctioned Republican candidate for governor has taken the position that you should be jailed for having oral sex, even if it is with your spouse? It would be one thing if some whack-job independent candidate started campaigning on a down with cheeseburgers or other idiotic platform but when the candidate from a major party starts talking about putting people in jail for consensual sexual relations then you should be very worried.

Same-sex marriage is illegal in Indiana, the Supreme Court decision notwithstanding. Starting on July 1 of next year, same-sex couples simply applying for a marriage license in Indiana can be fined $10,000 and be sentenced to 18 months in prison. These are the kind of laws that can get passed when people just sit back and say, "it doesn't affect me. Why should I care?"

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

Then the bartender says "we don't serve strings in here" so one of the strings tatters himself on top and ties up a few loose ends, then goes back to the bartender who says "are you a string?". To which he replies "No. I'm a frayed knot".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
RichTextBox1.LoadFile(filename)

will do the trick.

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

RichTextBox1.Text = "new text"

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

That depends on what, specifically you want to do. If you want to implement a search-and-replace feature where the user enters the text to search for and the replacement text then you do it one way. If you want to allow the user to select a block of text and replace it with some other text then you do it another way. Please give us some more details.

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

We used to have a panel-type quiz show in Canada called "This Is The Law". From Wikipedia:

It presented short, humorous vignettes which ran with musical accompaniment rather than a soundtrack, and challenged panelists to guess which (obscure) law was being broken by the "Lawbreaker" character... who always got arrested at the end of the vignette... The vignettes were quite subtle, and more often than not, despite many guesses, the panelists were unable to come up with the law that was actually being broken.

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

The US administration has overcome another hurdle in its quest for the power to indefinitely detain US citizens and others who are suspected of being affiliated with terrorists. Congress has granted the president the power to arrest and hold suspects without due process. This was granted as part of the National Defense Authorization Act of 2012. The president has said he will not abuse this power, however, in light of the actions of his administration so far, his assurances carry little weight.

Couple this with the mass gathering of meta-data and you get a system ripe for abuse. If your cell phone data shows that you are within several "hops" of a suspected terrorist or terrorist sympathizer you may be indefinitely detained without charges even being laid.

A few years ago I was only two steps removed from the pope and several heads of state of foreign nations. It doesn't take many hops to connect anyone with a "person of interest."

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

Are you also OK with them reading your email? Since 2003 they have been photographing the outside of every piece of mail processed by the Postal Service. How would you feel if they opened your snail-mail and read that? What invasion of your privacy would you NOT consent to? Virginia Attorney General Ken Cuccinelli (the Republican party nominee for governor) launched a new campaign website Wednesday highlighting his efforts to reinstate Virginia’s Crimes Against Nature law. This would make oral sex illegal, even between consenting adults (including married couples). Would you be OK with having your bedroom monitored to ensure that you complied with that law? What exactly are your limits of tolerance?

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

I think a combination is happening. Big Brother watches everything while the masses are distracted with fluff. How is it so many people are more concerned with what Kim Kardashian is up to than what the government is up to? Religion was supposed to be the opiate of the masses and now all it seems to do is fire people up. And not in a good way. TV = SOMA. I'd write a real scathing letter to the editor about that but Amazing Race is on. Maybe tomorrow.

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

After you bought a replacement for something you've lost and searched for everywhere, you'll find the original.

Losing one glove is certainly painful,
but nothing compared to the pain,
of losing one,
throwing away the other,
and finding the first one again.

  • Piet Hein
ddanbe commented: Great! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That is correct. When an error occurs in any line in the Try block, execution immediately transfers to the Catch block.

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

Then what you want is

Try
    whatever command you run to do the insert
    Call ClearFieldsAndVariables()
Catch ex As Exception
    MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
Finally
    con.Close()
End Try

What happens is if the insert fails the Catch block is immediately executed. If the insert succeeds then the statements following that (in the Try block) get executed. The Finally portion gets executed whether an error occurs or not.

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

They say it all here, eh.

mike_2000_17 commented: Awesome! +0
ddanbe commented: Great! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Except you'd use round instead of square brackets.

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

I don't see an INSERT query anywhere but if I had to guess it would be the embedded spaces in the column names. It's always a bad idea to use names with spaces. With a non-spaced name you can do

INSERT INTO myTable (idnum,FirstName) VALUES(123,'Jim')

But when you have a space (or when you are using a reserved word) you have to use

INSERT INTO myTable (idnum,[First Name]) VALUES(123,'Jim')

I find it easier to use names like FirstName or First_Name.

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

Harlan Ellison disagrees with the statement "everyone is entitled to an opinion". He claims "everyone is entitled to an informed opinion".

You honestly think if everyone had a gun on them at all times crime will increase?

Certainly suicides-by-gun would increase as well as accidental deaths, road rage shootings, alcohol-fueled bar shootings, etc. But, as you stated,

so if you're going to ban guns so people don't kill people you my as well cut everyones fist off, ban knives, ban hamemrs, well ban basically everything.

Ah, the old slippery slope argument. Any position taken to extreme is ridiculous. By your logic we should all be allowed to own tactical nukes. Three cheers for NNS (Neighbourhood Nuclear Superiority).

And I presume that the alarming number of children that are dying from accidental shootings by themselves or their siblings will, in the absence of guns, either accidentally stab or bludgeon themselves and their siblings to death.

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

The virus could be introduced into your system in a number of ways. Some of them are

  • you opened an email attachment with an executable that contained the virus
  • you downloaded and installed a program that contained the virus
  • you visited a rogue web site that installed the virus
  • you plugged in an infected external device with AutoPlay enabled
  • you gave someone physical access to your computer and he/she installed the virus
  • your system was not protected with a firewall and someone hacked in

This list is far from complete.

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

A good programmer is not necessarily someone who spews out a lot of code quickly. Sometimes spewing out code quickly is required (fortunately not often), but over 32 years or so of employment I learned that my job was primarily to solve problems, not to write code. And when code was necessary, it was to write a little of it as possible. And when I wrote that code, it had to be as obvious (as free of tricks) as possible so as to be maintainable.

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

When the message pops up, start Task Manager and go to the Applications tab. Select the application that is displaying the message (you should be able to narrow it down) then Right Click and Go To Process. Once you know what process is generating the message you can use MSCONFIG to disable that program. If MSCONFIG doesn't list it then use Autoruns

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

Cop shows that include a 5 minute foot chase. This is usually the result of the cops shouting out a suspect's name from half a block away instead of waiting until they are within arm's reach. Inevitably the suspect runs into the path of a car or truck and the chase ends up being pointless anyway.

Cop shows where six cops burst in the front door of an apartment/house but neglect to post anyone at the fire escape/back door which is the only other exit. This leads to another pointless (and prolonged) foot chase.

Shows where a victim is being chased by a bad guy and manages to knock him down, leaving him momentarily helpless - then doesn't break his kneecaps or grab his gun. Also shows where the good guy and bad guy duke it out while 10 people watch but do not help or grab the gun which has fallen to one side.

Cop shows where the computer geek can instantly cross reference any data from one data base with any data from another database. "I need you to cross-reference left-handed Nazi lesbians with Ford owners in Atlanta who have had a wart removed". Ever notice that on these shows, the computer geek uses only the keyboard?

Shows where the computer geek guesses the password in 10 seconds after glancing around the room.

CSI shows where there is always one bit of forensic evidence that immediately narrows the suspects or areas down to a single person or location. …

Ketsuekiame commented: Please let me up-vote this more than once o.O +0
XP78USER commented: me too +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

According to NASA, it takes 17.5 trees to produce the ogygen required to support one person, but 20 trees per person to consume the CO2 produced by one person. They did not mention what specific type of tree.

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

I see the same small set of questions being asked again and again. After a while I get tired of showing how to read/write Excel files from vb. There just aren't that many challenging questions any more and I really don't feel like answering questions for posters who are too bloody lazy to use SEARCH. I'm at the point where I don't even want to say "here's a link to the answer you lazy oik".

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

Just a suggestion for anyone looking for a (probably) challenging app using the daniweb api. How about displaying a map of the world showing the location of danaweb users? Depending on what info is available via the api this could be restricted to users with a minimum number of posts or those who have posted/logged on within a given number of months.

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

How did "Is DaniWeb VERY slow for you" turn into this? Aren't we just a tad off topic?

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

If I understand you, what you want to do is detect the ENTER key in the rich text box and do some special processing. You can use the KeyDown event for that.

Private Sub RichTextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown

    If e.KeyCode = Keys.Enter Then
        'add custom processing code here
        e.SuppressKeyPress = True
    End If

End Sub

Setting e.SuppressKeyPress to True prevents the ENTER key from being further processed by the control.

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

Two possible scenarios

  1. If the data is in tabular form you can open the Excel files using ADO or OleDb and read the data like a database
  2. You can use automation objects to access the data cell by cell

I have a sample project for each that I will try to attach to this post.

ddanbe commented: Great! +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

"If I hadn't have believed it I wouldn't have seen it". - Ashleigh Brilliant

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

i dont want to use label

I don't know why not. It's so simple. You don't even have to name the label unless you want to modify the text after you place it.

Dim lbl As New Label
lbl.Font = New Font("Arial", 12.0!, FontStyle.Regular, GraphicsUnit.Point, CType(0, Byte))
lbl.Location = New Point(40, 50)
lbl.Text = "Sample Text"
Me.Controls.Add(lbl)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

do some useful worok rather than giving pointless and illogical suggestions...

He's baaaaack. Didn't take as long as I thought it would.

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

Instead of having two variables for isFirstPlayerTurn and isSecondPlayerTurn, why not just have one variable that contains either "X" or "O"? Then you only need one test as in

If Player = "X" Then

and you can toggle by

Player = IIF(Player = "X", "O", "X")

Also, if you use a common click event for all tiles you can just do

Dim btn As Button = sender
btn.Text = Player

There is a lot of unnecessary code in your original post.

Begginnerdev commented: IIF to the rescue! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I prefer to avoid the terms ShortInt and LongInt as they vary depending on the architecture. The number refers to the number of bits (binary digits). For example, Int16 is a 16 bit value. To summarize, as beginnerdev said

Int16 - 16 bit - range is -32768 to 32727
Int32 - 32 bit - range is -2,147,483,648 to 2,147,483,647
Int64 - 64 bit - range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

The max value is determined by raising 2 to the power of the number of bits - 1 (because the leftmost bit is a sign bit) then subtracting 1. So for a 16 bit int (signed) the max value is 2**15 - 1 or 32767.

However, if you are only concerned about positive numbers then you can used their unsigned counterparts which do not reserve a sign bit. These are

UInt16 - max value is 2**16 - 1 or 65,535
UInt32 - max value is 2**32 - 1 or 4,294,967,295
UInt64 - max value is 2**64 - 1 or 18,446,744,073,709,551,615
Begginnerdev commented: Great example! +8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

@diafol yes, i am THAT nitin who was stalking WatlP

Based on your behaviour the last time around and assuming an undelete was even possible, what could possibly motivate the powers that be to do so?

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

I prefer it without the preview actually. Not because it's slow, but because I have to click or scroll down to get to the Reply button.

Same here. I know I could hide the live preview but it was a nuisance to have to do it every time. This was especially bothersome when we were editing the thousands of badly formatted posts. Perhaps this could be an option in the user profile (enable/disable live preview) with a default of disable.

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

Remember that we live in a society that demands we protect people from themselves at the risk of litigation. Note that we apparently do not live in a society that requires (or expects) people to think for themselves or even display a modicum of common sense.

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

The letters in the phrase TWELVE PLUS ONE can be rearranged to form ELEVEN PLUS TWO so the following is true in two senses

TWELVE PLUS ONE = ELEVEN PLUS TWO

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

If you are a total beginner in programming then I suggest a simpler project to get your feet wet.

ddanbe commented: Talk of a wise man. +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I can see that you could be required to provide a password for an encrypted file or folder at Customs when entering the US (although I disagree with the legality) however, at least in Canada, you would not be required to decrypt files either for cloud or locally hosted files unless a search warrant was first produced. Because SpiderOak does not have access to your keys they are required to provide access only to the encrypted files.

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

You don't have to pick one of the forums from the drop-down menu. Just click on the top level item in the menu bar. Just be sure that when you post the question you add tags to help in searching. And please, please, please take the time to create a meaningful title for your thread.

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

Based on old British movies (and one episode of Ripping Yarns), five minutes after birth, all children are shipped off to boarding school where they are tortured mercilessly by their peers until they graduate.

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

This whole story is nothing more than bullshit.

A proper rebuttal consists or more than the above statement. You could claim, for example, that the sample size is too small to be statistically significant, but to just cry bullshit is about as valid as shouting "is not".

The story is also copied word for word from the referenced site which may be a violation of the DaniWeb rules

  • Do ensure you own the intellectual property rights to everything that you post
  • Do not post copyright-infringing material
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've always hated that saying about "it takes a village to raise a child". As far as I can tell it has been interpreted as "Great. Let the village raise my kids". Too many parents have abdicated their roles and let their children be raised by teachers, TV, movies and/or the street. And when the kids turn out bad they blame teachers, TV, movies, video games, etc. It's never their fault.

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

You could use regular expressions

Dim rex As New System.Text.RegularExpressions.Regex("[^ ]")
lblMylabel.Text = rex.Replace(lblMylabel.Text, "x")

The expression "[^ ]" matches any non-blank character. Rex.Replace scans the given string and replaces any matching string with the second string so basically it says replace any non-blank character with an x.

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

If you mean like changing "My Label" to "xxxxxxxx" then you could try

lblLabel.Text = Space(lblLabel.Text.Length).Replace(" ", "x")

Space(lblLabel.Text.Length) generates a string of blanks the same length as the label text and Replace(" ","x") replaces all of the blanks with the desired character.

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

I've attached a sample robocopy project. I redirect StdOut so I can capture and display it. You can also do the same for StdErr. Note that robocopy (in the command line) rewrites the current line to display percentages. You'll have to decide how to handle this when you display in a textbox.

You cannot write to a control in the main form from a background thread so we use a delegate.

Feel free to ask more questions.

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

In order to demonstrate this, years ago when I was taking statistics in university, a statistician demonstrated that the major cause of divorce was importing apples from New Zealand. The two things had the highest correlation of all things studied. As he went on to say, (at that time) only people with snotloads of money would pay the expense of imiporting apples from New Zealand, and the divorce rate among the wealthy was higher (at least at the time of the study) than the non-wealthy. As he went on to say, correlation does not imply causation. The lesson stuck with me.