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

It was a long shot. I'm not well versed in data adapters and such. I prefer direct access.

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

Judging by Values(?,?) it looks like you created a query with parameters but didn't actually replace the parameters with values.

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

I don't use any online storage but I would imagine SpiderOak is preferable to DropBox. SpiderOak uses on-the-fly encryption (meaning you don't have to manually encrypt your files) and it is secure in that the SpiderOak staff do not have access to the keys. No one there can decrypt your data even under court order. DropBox has admitted that unless you encrypt your files before uploading they can be accessed by the authorities upon request.

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

If you only want to allow certain characters then you can filter them in the KeyDown event. The clearest way is

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

    Select Case e.KeyValue
        Case Keys.A To Keys.Z
        Case Keys.Space
        Case Keys.Left, Keys.Right, Keys.Back
        Case Else : e.SuppressKeyPress = True
    End Select

End Sub

Just add extra Case statements for other characters you want to allow. I allow Keys.Left, Keys.Right and Keys.Back to allow the user to edit already entered characters. Setting e.SuppressKeyPress to True causes the typed character to be ignored.

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

Don't read the entire file into memory. Use a StreamReader to read one line at a time.

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 guess you didn't look here. I wrote the ListView Column Sort Demo code snippet just for that. You really should browse the Code Snippets.

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

You can order ascending or descending, or you can take the order that it appears in the database. Or you can retrieve the records into a recordset and loop over the values in the IN clause. You can't force SQL to order them the way you want.

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

In the absence of an ORDER BY clause, the query returns the results in the order in which they appear in the database. If you have a field defined as a primary key then that defines the physical order.

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

Your first suggestion was ok but it keeps the last unmatched character until next key is pressed

Not on my computer. On my computer non-matching keys are ignored. Unmatched keys are never displayed.

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

If you use my suggested code along with AutoComplete set to Suggest and AutoCompleteSource set to ListItems you will get what you want. You can also try the two other AutoCompleteModes to see if that action suits you better.

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

Try this

Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress

    Dim cbx As ComboBox = sender
    e.Handled = cbx.FindString(cbx.Text & e.KeyChar, 1) = -1 And Asc(e.KeyChar) <> 8

End Sub

although there are still ways to screw it up. For example, if one of the acceptable words is "aardvark" and you enter "aardv" then cursor left twice and delete a character you will end up with a typed entry that does not match any word in the list. You'd have to add code to handle this or disable cursor keys.

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

If you are doing an UPDATE rather than an INSERT then you will be overwriting existing values so tagging the records with the date of the update won't help. How about the following structure

Update_Date (PK)
CB_ID int (PK)
CB_Mnemonic_ID int (FK)
CB_Value decimal (18,10)
CB_Year int
CB_Quarter int

and make the primary key a compound key consisting of the update date and CBID. That way you retain all historical data. This is what I did with the Dovercourt EMS analog point data. We had to maintain the historic values. At 8000+ points every hour the data does tend to pile up (around 400 meg per month).

Stuugie commented: Thanks for the feedback +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can't convert a null string to a number. You'll have to decide how you want to treat non-numeric entries. What do you want to do if no value is entered? What about non-blank but non-numeric values such as "abc" or "1.2.3"? We can't make those decisions for you.

By the way, the link to your image was not formatted correctly. I fixed it.

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

Personally, I don't use any online storage. I don't trust any external service to securely maintain a copy of my data. I know that I can always use something like TrueCrypt in coonjunction with DropBox but that requires resynching the entire TrueCrypt container even if only one file in that container is modified. When I need to exchange large amounts of data with a remote PC I use either Hamachi and map a drive or TeamViewer filecopy.

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

Try using the Random class as in

Dim rand As New Random
Randomize()
Me.Text = rand.Next(1, 11)

rand.Next(min,SortOfMax)

returns a random number in the range min to SortOfMax-1

so rand.Next(1,11) returns a random integer from 1 to 10. I use the name SortOfMax because the Microsoft documentation used to say Next(min,max) which was highly misleading. Now it says

Next(Int32, Int32) Returns a random number within a specified range.

which is still misleading.

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

Sorry. I don't do C#. Perhaps someone else can step in.

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

Try

SELECT tbl_course.course_id, tbl_course.course_name
  FROM tbl_enrollment INNER JOIN tbl_course ON tbl_enrollment.course_id = tbl_course.course_id
 WHERE student_id = '" + lbl_StudentID.Text + "')"

When you get the query working I suggest you change it to use parameters. Examples of how to do this with OleDB or SqlClient can be found here. If student_id is numeric then you don't need the single quotes around it.

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

I've attached a sample project in which I created a custom textbox control. The only difference between the custom control and the standard textbox is that the background color is forced to white regardless of the ReadOnly property. Well, I'm trying. I keep getting The file could not be written to disk. I'll try to post it again later.

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

I tried it before I posted it and, yes, it does. Are your textboxes in another collection like a panel or groupbox? If so then you have to iterate through that collection instead.

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

Confiscating computers from people is also futile

If the point is trying to decrypt your data, then yes. If the point is to coerce you into giving up the password or punishing you for refusing to do so, then no.

Whatever the technique, it would be very difficult

These days one can always make something that will explode. If the security people are checking shoes then you make exploding underwear. Now that we can 3D print guns out of resin people will be sneaking those on planes. It's the Red Queen's race.

As for encryption, Truecrypt offers a hidden, undetectable encrypted container in a container. But as I said, if your laptop is suspicious (or you are) your laptop can be confiscated without reasonable cause.

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

You could put the following in the form load event

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

For what it's worth please see here

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

The following is taken from the article I referenced titled Laptop Searches at the Border: What the Revised U.S. Guidelines Say

U.S. Customs officers have the authority to search and detain any device capable of storing electronic information for any reason; they can examine the electronic device without the traveller present; they can copy from the device or “detain” the device; and they do not need to obtain the traveller’s consent to conduct the search. “Electronic devices” can include computers, BlackBerrys or similar devices, cell phones, travel drives, DVDs and CD-ROMs, cameras, music and other electronic media players.

The fourth amendment is the part of the Bill of Rights which guards against unreasonable searches and seizures. If the customs officers now have the authority to search and detain any device capable of storing electronic information for any reason then the new guidelines have apparently nullified the fourth amendment. My apologies if I confused this with the powers granted by the Patriot Act.

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

In America there is the Bill of Rights

You have the Patriot Act now which gives the government the power to do pretty much what they want. As I posted earlier in this thread, here's what the Revised US Guidlines say. As the customs officials are confiscating your laptop because they don't like your demeanor just see how far you get shouting "fourth amendment". I almost got turned back at customs for having an apple. I mean the fruit kind, not the computer kind.

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

The idea that you can be forced to reveal private data is just a mistake.

That's why I said "at the risk of having your computer confiscated". You can always claim you don't know the password (and there are legitimate reasons why you might not), but customs can then refuse to return your computer.

they know before they start that they'll never find anything anyone seriously wants to hide.

Stupid people do stupid things. Smart people do stupid things. By your reasoning, they shouldn't bother looking for weapons either because a really clever person would find a way to get one on board. Every few months I read about some dude who got caught with child porn on his computer in his home. A smart person would have hidden it better. I'd say that a smart person wouldn't have had it at all but I suppose the things that drive a person to crave child porn are unrelated to one's intelligence.

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

I can only encourage you to drop this subject like it was a hot rock.

I don't advocate trying to smuggle digital contraband through customs, but I think the idea that you can be forced to reveal private data at the risk of having your computer confiscated is a subject worth discussing. In Canada, we had a member of parliament who had the audacity to state that anyone who was against blatantly illegal invasions of privacy was siding with the child pornographers.

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

Why would terrorists resort to trying to smuggle any kind of data, encrypted or otherwise, across international borders on physical media? This is just stupid. All you have to do is encrypt it or hide it using steganography and park it online on a server somewhere - even as an attachment to a draft message in hotmail. Then you can access it from anywhere. No need to arouse the curiosity of a border guard with a physical device. If you use a technique like bit slicing you can divvy up the data into physically separate packages and store it online in several different places. If you do that then the data can't possibly be decrypted without having all the pieces and knowing how they go together.

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

If nothing happens when you use the IP address then I don't think it is a DNS problem because there is no name resolution being done.

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

You're right. TABLOCKX would be preferred.

TABLOCK forces a full table lock rather than whatever the lock manager would have used but can create contention problems if other users want to modify data in the table.

TABLOCKX creates an exclusive lock that locks all other users out of the table for the duration of the statement.

I have to wonder why anyone would use TABLOCK over TABLOCKX.

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

You can do it in one statement by

INSERT INTO ORDERNUMBERREC
    (OrderNo,UserId,CreateDate)
SELECT MAX(OrderNo)+1,'system',GETDATE()
    FROM ORDERNUMBERREC
WITH (TABLOCK)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

To prevent multiple items from being selected you set

ListBox1.SelectionMode = SelectionMode.One

To allow multipl selections use

ListBox1.SelectionMode = SelectionMode.MultiExtended

To select via code you add items to the SelectedItems collection as in

ListBox1.SelectedItems.Add(ListBox1.Items(i))

where i is the zero-relative index of the item you want to select. However, once you go back to Single select, all of the lines that are selected except for one will be un-highlighted.

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

I forwarded this article (and the other one you posted on anti-oxidants) to my son at Stony Brook. His research involves mitochondria, and as coincidence would have it, was able to talk with Dr. Watson at a recent conference.

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

Easiest way is to wuery the database as in

SELECT COUNT(*) WHERE Username = 'joeblow'

If the returned value is 0 then the username is available. I suggest you use parameters to create the query string. How you do that depends on whether you are using OleDB or SqlClient. You can find examples of both here

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

What happens if you open your browser and type

http://74.125.225.115/

into the address bar and press ENTER? It should bring up Google.

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

I didn't know where the "•" character was :-P

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

If the PasswordChar property of the textbox is set to a character (such as asterisk) then anything you type will display as that character.

TextBox1.PasswordChar = "*"
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you pour crap in your gas tank your car will perform poorly. Same thing if you install crap on your Windows based PC. That's been my experience after a couple of decades supporting Windows PCs at work. The machines that didn't get screwed up by the users performed quite nicely.

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

Or you can test the operands before you do the divide to see if the denominator is zero.

ddanbe commented: Life can be really simple. +14
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You saw the part about "detained or sent back to their country of origin"? How happy would you be if you flew from (for example) England to New York, then were sent back home because you refused to reveal a password? Would you be happy because your password was uncrackable? I know this is unlikely, but the possibility exists. I occasionally have problems crossing into the US because I have mild Tourette's so I appear nervous and fidgety at times. Kinda makes me a target to the right official. And I almost always travel with my laptop.

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

From How to Secure Your Laptop Before Crossing the Border

Do you regularly travel to the U.S. on business? If you take confidential information of any kind with you, take heed: US policy allows offers of Customs and Border Protection (CBP) to search and confiscate computers, phones, personal digital assistants, cameras, digital music players and other data-storing devices. Operating under the U.S. Policy Regarding Border Search of Information, agents have also downloaded the contents of entire computer hard drives and other storage media for later review. (Note: similar situations occur at the borders of other countries as well.)

For many travelers, CBP reassurances that confidential data is handled carefully ring hollow. And travelers who resist searches, even by insisting that such searches would require a warrant and probable cause if conducted within the United States, can be detained, sent back to their country of origin or otherwise grievously inconvenienced.
These recent developments have many legal experts and others asserting that the “border privacy” playing field is undeniably tilted in favour of border agents.

This article suggests 10 steps you can take to shield sensitive information, like that protected by solicitor-client privilege, when crossing the border. Each one comes with caveats, the most important of which is that there are no guarantees. You should consult an IT security expert to help you choose the best options for your needs.

And Laptop Searches at the Border: What the Revised U.S. Guidelines Say

In summary...

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

I have been told that when entering the US, customs officials can insist that you reveal the password for an engrypted file or partition. I am not aware if anyone has successfully challenged the legality of this, for example, by claiming that the encrypted information contains priviledged lawyer-client communications. I do know that TrueCrypt provides a method of creating a second, hidden container within a TrueCrypt file in the event that you are forced to reveal a password. I suppose there are always other methods such as creating a TrueCrypt partition, then modifying the partition table manually so that it shows as RAW. There are always workarounds. However, never underestimate the power of computer forensic tools.

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

Or you can just create a TrueCrypt folder and stick the media files in there. While it is true that most airport officials are too busy (and too untrained) to thoroughly search a laptop, if you get singled out for any reason (I was once for being in possession oa a weapon of mass fruit - I forgot to declare an apple), that could lead to extra special attention in which case a laptop may be seized and searched because some underpaid grunt was having a bad day.

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

You have to show some effort first. What have you got so far?

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

Don't do

strMonths.ToString(intCount)

ToString is evaluated first on strMonths resulting in "System.String[]". Because strMonths is already of type String (array), there is no need to apply ToString. Just use

strMonths.(intCount)

To clear an array you just loop over all the elements and set each one to zero such as

For i As Integer = 0 To Ubound(myArray)
    myArray(i) = 0
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The usual way is to use wildcards. You didn't say what database you are using so I'll just give you the one for MS SQL.

SELECT * FROM mytable WHERE stockNumber LIKE 'CC%'

This selects all records where stockNumber starts with CC. Other databases may use other characters for wildcards. In MS SQL, "%" matches any string and "_" matches any single character. More information is available here

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

If the source for the DataGrid is a database you should be able to do it with a single query. If you provide more detail perhaps I can suggest something.

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

One of the things that put me off Linux was the large amount on information that is assumed to be common knowledge. If I asked a question I only ever got 50% of what I needed for the solution - even something as simple as enabling a wireless connection to my router. I finally found out after several weeks that I had to install a package that everyone jst assumed I already had even though it wasn't installed when I set up Linux and wasn't offered as an option.

download the installer, run it, click "next" about a dozen times, wait for an incredibly long period of time, and then, possibly restart)

And then uninstall Bing or Ask ToolBar or whatever other crapware gets installed along with it.

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

I admit I ignored a lot of the Linux development. But I did that in order to make the point that Linux was not developed to be different from Windows but to be similar to Unix. And Unix was developed long before Windows. But it's good to have people around who will keep me honest ;-P