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

I ran up against the IT gestapo more than once. There was one sight in particular (which I have long since forgotten) which they refused to unblock. The only way I was able to get at it was at home on my own time. The only reason I was given for the blockage was "it's corporate policy".

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

yo! this is my problem, not urs. start ur own topic!!!

It makes more sense to ask it here where it is in context. In any case, it's just the name he gave to his menu control item.

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

That was an extreme case of making a false assumption and I suggested it to (perhaps badly) make a point. I think It is valid to assume that turning a candle horizontally will make it burn faster. in that case, the solution os to cut the candles in two and burn them vertically. You can find the midpoint by placing the candle horizontally on your index fingers (one at each end) then slowly moving your fingers together. The candle will stay balanced. Your fingers will meet at the midpoint.

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

Stuugie works at a place where IT is somewhat gung-ho about blocking sites that are of use to programmers. Not all sites; just some of the ones I used to frequent (I worked at the same place for 29 years).

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

I'm not good at creating puzzles but I love to solve them.

The question states that each candle burns completely in one hour. That doesn't mean that after half an hour the candle is half gone. If the candle is wider at the bottom than the top, it could take 20 minutes to burn through half its height and 40 minutes to burn the remainder.

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

I'd use a chat feature for non-help related discussions but I doubt I'd use it to help someone except in rare circumstances. It's easy to offer help in one's one time and at one's own pace using the threads. It's another thing entirely to get stuck in an endless interactive chat and not being able to politely walk away. I've only come across two cases in two years when I'd be willing to "go live".

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

It's certainly possible. How you do it depends on a few things. For example

  1. Is each plant description in a separate file?
  2. How are the fields identified

My preference is to read files all at once. This avoids the cumbersome process of setting up stream readers, opening, closing, etc. Let's make a few assumptions

  1. the plant info is in a separate file for each plant (where the file is named as plantname.txt)
  2. the folder containing the plant info files is stored in PLANTINFO
  3. the name of the selected plant has been copied to a string variable, plant

then reading all of the info for a plant is as simple as

Dim infofile As String = System.IO.Path.Combine(PLANTINFO, plant & ".txt")

If My.Computer.FileSystem.FileExists(infofile) Then
    Dim info() As String = System.IO.File.ReadAllLines(infofile)
Else
    MsgBox("No file found for " & plant)
    Exit Sub
End If

Now, of course, you have to go through the various lines just read and get the plant properties. This depends on how the file is arranged. For example, if the lines look like

DESCRIPTION: some text
LIGHT:       some more text
ZONE:        still more text
HEIGHT:      yet more text

Then you can parse out the fields by

For Each line As String In info
    If Trim(line) <> "" Then
        Dim fields() As String = line.Split(":")
        Select Case UCase(fields(0))
            Case "DESCRIPTION"
                'copy fields(1) to textbox
            Case "LIGHT"
                'copy fields(1) to textbox
            Case "ZONE"
                'copy fields(1) to textbox
            Case "HEIGHT"                    
                'copy fields(1) to textbox
            Case
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I feel Reverend Jim might have read and saw The Browning Version.

Actually, no. Never saw it.

I am not a very emotional person when it comes to movies/dramas

I have to admit, I cried when the old man's wife died in "Up".

Twilight Breaking Dawn Part 2 because my daughter likes it.

I'm ever so glad I had sons.

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

You could try setting the forms KeyPreview property to True. You'll have to do some pre-processing in one of the form's Key events (KeyDown, KeyPress, KeyUp) to ensure the characters are handled properly.

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

False assumption. You all assume the candles burn at an even rate. They would not if they were tapered candles. Also, a candle will burn faster when turned horizontally as the wax will melt and drip off rather than burn.

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

The student who commits suicide is played by the same actor who played Wilson (Watson) on House.

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

The default value for what? When you run the following code

Private Sub ComboBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

    myConnection = New SqlConnection(connectionstring)
    myConnection.Open()

    myCommand = New SqlCommand(" Select  Name FROM [Product_Name_List] Where P_Id='" & ComboBox2.Text & "'", myConnection)
    Dim dr As SqlDataReader = myCommand.ExecuteReader

    ComboBox2.Items.Clear

    While dr.Read()
        Debug.WriteLine(dr(0))
        TextBox8.Text = Val(dr(0)).ToString
    End While

    dr.Close()
    myConnection.Close()

End Sub

what is the output in the debug window?

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

Try adding "HDR=No" to the extended properties.

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

Try this

dbCon = New MySqlConnection("SERVER=localhost;DATABASE=test;")

Dim ds As New DataSet
Dim da As New SqlDataAdapter
da.SelectCommand = New SqlCommand("SELECT Name FROM students", dbCon)

dbCon.Open()
da.Fill(ds)
dbCon.Close()

cmbname.DataSource = ds.Tables(0)
cmbname.DisplayMember = "Name"

or more concisely

Dim ds As New DataSet
Dim da As New SqlDataAdapter("SELECT Name FROM students","SERVER=localhost;DATABASE=test;")

da.Fill(ds)

cmbname.DataSource = ds.Tables(0)
cmbname.DisplayMember = "Name"
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Make your own then.

I'd rather remove my own spleen with only a bottle of scotch and a rusty razor blade than do web programming. It's much easier to just complain. I'm old and it's what old people do best :P

pritaeas commented: Well said! +0
Nick Evan commented: Hehe :) +0
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What happens when you run the following code

Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Persist Security Info = False; Data Source = | DataDirectory | \ db.mdb"

For Each item In ListBox1.Items

    dim cmd_sel OleDb.OleDbCommand con.CreateCommand = ()
    cmd_sel.CommandText = "SELECT Field1, Field2 FROM WHERE Tabla Field1 LIKE '" & item & "'"
    Dim oledbReader OleDb.OleDbDataReader

    con.Open ()
    oledbReader cmd_sel.ExecuteReader = ()

    While oledbReader.Read ()
        Debug.WriteLine(oledbReader.Item(1))
        ListBox3.Items.Add (oledbReader.Item(1))
    Loop

oledbReader.Close ()
con.close ()

I want to know what appears in the debug output window. Also, what's the idea of the frequent appearance of "the" in your code as in

The Dim oledbReader OleDb.OleDbDataReader

and

While the oledbReader.Read ()
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

and one more thing

Please start a new thread for this.

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

Now if I could only remember where I left my car keys and my glasses.

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

I refuse to use an online bookmarking system that I don't trust and I do not trust Google, Facebook, LinkedIn, etc to keep my information private.

However, I trust DaniWeb so I would have no objections to storing DaniWeb bookmarks on DaniWeb itself.

Dani commented: Thank you for the vote of confidence! +0
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In Total Recall he lost his arms while he was dangling from the elevator. In The Machinist it was in a piece of shop machinery. In Starship Troopers it was in a sandpit while being attacked by bugs.

LastMitch commented: You are a got memory! +0
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For future reference, it is not necessary to post files on RapidShare or any other external website. Files can be attached directly to posts here.

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

You can use SelectedIndexChanged

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

RE: Total Recall (the Arnold version). Is it just me or does Michael Ironside tend to lose limbs a lot in his movies? He lost both arms in Total Recall, one arm in The Machinist and either his arms or his legs (I forget which) in Starship Troopers.

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

Granted, questions might be answered more quickly with an interactive dialog, but would those dialogs be recorded in the forum the same as the current post/response so that others could browse them?

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

I don't believe this belongs in the vb.NET forum. Perhaps java or web development? I can move it if you have a preference.

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

In 1998 my entire group moved from our old control centre into a brand new, state of the art, hurricane proof, hi-tech, custom designed building. Including the system control operators, support staff and R&D staff there were about 85 people in the new building. After a month of settling in I wrote in big block letters on an easel in the main conference room what I think was an original quote from me.

Just because everything is different doesn't mean anything has changed

Sure enough. For the next ten years it was the same old bulls%%t. I think this ties in nicely with the Einstein quote above.

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

You can use the TextChanged event handler of TextBox2. In the body, just add code to copy the new value to TextBox1 as in

Dim txt As TextBox = sender
Form1.TextBox1.Text = txt.text
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

First of all, you have hijacked someone else's thread (and an old one at that). That is frowned upon here. For new questions please start new threads.

The query to update the quantity field in Shop would be

UPDATE Shop 
   SET Quantity = Quantity - 1
 WHERE ItemCode = 'some code'

For example, if the ItemCode is in txtItemCode (a textbox control) the query string can be created by

query = "UPDATE Shop " & _
        "   SET Quantity = Quantity - 1 " & _
        " WHERE ItemCode = '" & txtItemCode.Text & "'"

If ItemCode is entered into a textbox then you should use parameters to guard against SQL injection. If it is selected from a combobox then the above code is safe.

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

As I understand it, I could go and upvote all of the posts that were downvoted by xbat but that wouldn't undo the damage. The posts would have a net balance of zero, but the down votes would still affect his posting quality rating. The only one who can actually make the down votes go away is the OP who can no longer do that by virtue of being banned. And as was discussed on another thread, directly modifying the database to undo the damage could cause other problems with the database.

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

If you have been threatened or abused then please post links to the threatening/abusive posts or use the "Flag Bad Post" tool to initiate a follow-up.

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

Fair enough. Thanks for the feedback from everyone.

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

why not just use your browser's bookmark feature?

It is not integrated with DaniWeb. An integrated feature would contain only DaniWeb related bookmarks. An "insert bookmark" button would insert the link in the format appropriate to DaniWeb with the displayed text in square brackets followed by the link in parentheses. As I also stated above, DaniWeb bookmarks would be associated with my DaniWeb account (just like watched articles and other settings) rather than with my computer. As an example, my computer is in the shop for a couple of weeks so I am using an old clunker with a crappy "A" key and other problems so I do not have access to my browser bookmarks. DniWeb bookmarks would always be available to me on any computer.

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

The bookmarks would get lost in the watch list (I currently have 3 pages of Watched articles). And the feature as I have suggested it would allow a quick and easy method of insertion into posts (public or private).

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

As if you didn't have enough to do...

There are certain articles that I would like to bookmark because I either want to return to them at a later date for a more detailed look, or that I would like to cite in response to a new question (usually one that keeps getting asked by different people). I know I can bookmark using my browser but I can't access these bookmarks if I have to restore an image (unless I export and import) or if I am on another machine.

I suggest a bookmark feture that is internal to DaniWeb. The feature would allow me to create a list associated with my userid. If I bookmark a particular post in a thread, it could be saved as

[Thread Name](post URL)

Clicking on the bookmark would take me to the post (just like a regular link in post) but I could also copy and paste it into a thread. Perhaps a button on the edit box (labeled Bookmark) could display a popup of my bookmarks for selection and insertion similar to the Code button.

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

RE: A Beautiful Mind. I really enjoyed it as well, but I've learned that "based on a true story" can mean various things. It can mean (some day I will rant about the movie Iron Will)

  1. we created characters for the sake of the story
  2. we combined characters for the sake of the story
  3. we made s##t up just for the hell of it
  4. we out and out lied about everything

In the case of this movie, the sin was leaving out all of the unsavory aspects of Nash's character to make him more sympathetic.

And Russel Crowe was amazing.

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

Surprisingly, "Being There". Possibly Peter Sellers' best performance. And, as an aside, IMO the best ever performance (ever) by an actor was by Peter O'Toole in Lawrence of Arabia. Further seque, has nyone here ever seen "The Ruling Class"?

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

For a question like this I usually like to play with it myself to verify but I can't do that because my laptop is in the shop, probably until after the weekend. My temp is n old Thinkpad with little RAM, no dev tools and a flky "A" key. If you can wait I cn have a look in a few days. If not, perhaps someone else can chime in.

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

My experience with IRC clients was not positive. I found them difficult to use and not user friendly.

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

I don't have access to a system to verify this but two options come to mind.

  1. get a list of all PIDs of processes named java.exe just prior to launching the new instance then use that list to determine the PID of the new process, then use that PID when it is time to kill it.

  2. see if the PID of the new process is returned by the call that spawns the new java.exe and use that to do the kill later on.

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

@urtrivedi - I am assuming that because you are using private IP addreses that

  1. both PCs are on the same LAN
  2. both PCs are behind a router

In that case, the address of the gateway (I'm also assuming the third address in each group is the gateway) should be the address of the router. Many routers reserve 192.168.1.1 for themselves. In that case the addresses should be more like

PC1          192.168.1.2
SUBNET MASK  255.255.255.0
GATEWAY      192.168.1.1 (router)

PC2          192.168.1.3
SUBNET MASK  255.255.255.0
GATEWAY      192.168.1.1 (router)
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Go the the machine on which the code works. On the line of code just prior to opening the connection, add the following line (I'm going to assume your connection object is called conn. If not then replace it with the actual object name)

Debug.WriteLine(conn.ConnectionString)

Post the output of that statement back here. Once we see the string we will be able to show you what parts need to be modified for the other system. You only want to have to enter the parameters once per system so I suggest you use Settings variables to store them between sessions. You will likely need three (four, if the database name is different on the other machine). If you don't know how to create Settings variables there are many examples on this forum. I suggest

ServerName   String
UserName     String
Password     String

You access the values as (for example)

My.Settings.ServerName

Just treat them like any other variable. Check the values at form load and if the values are blank you can prompt the user to enter the appropriate strings. Just make sure you save them back into the My.Settings.ServerName, etc. variables so they get preserved between sessions.

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

You can't have two PCs on the same LAN with the same IP address. What kind of connection are you trying to make?

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

I was taught that when doing database "stuff" the generally accepted practice is to open the connection as late as possible, do what you gotta do, then close the connection as soon as possible. Also, as someone who learned to code long before all of the fancy interfaces and abstractions, I prefer to have as few layers between me and my data as possible. As such, my preference is to have files open for only a short time and to read all of the data at once (unless processing extremely large files).

Based on that, my preference would be to avoid StreamReader (and the associated open, end-of-file test, read, close) and just read the entire file into the "question" array in one step as I showed you earlier. That reduces your code to a simple

if the file exists
    read it
else
    display "file not found message"
end if

and you can split the lines into fields at that point (that way you can verify up front that all lines are valid) or step through them one at a time as needed. There are many ways to attack this and no particular way is the "right" way.

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

No attitude at all. I like the helpfulness of the members but I hate the pig behind the lipstick.

I dunno. Referring to someone's lovingly crafted system (of which I am quite pleased by the way) as lipstick on a pig sounds like attitude to me. Saying "I don't care for the interface", or "I find it difficult and/or frustrating" is one thing. But "lipstick on a pig" is just insulting.

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

Give that a shot and let me know how it goes.

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

You could declare two class level variables; one to contain the strings (the question array) and another to indicate which is the current question. You could code a Sub which splits the current question into the separate fields, then copies the values into text fields for display. Then, after the user enters his or her answer and clicks on a SUBMIT button, that button code would evaluate the answer, update the score (if any), increment the question number then call the Sub to display the next question. If there are no more questions then the final results could then be displayed.

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

I don't have access to my dev environment for the next few days so I'll try from memory. You can read all lines of the file into an array as follows

Dim questions() As String = System.IO.File.ReadAllLines(filename)

Then you can step through each question as

For Each line As String In questions

    Dim fields() As String = line.Split(",")
    Dim num1 As Integer = CInt(fields(0))
    Dim num2 As Integer = CInt(fields(1))
    Dim num3 As Integer = CInt(fields(2))       
    .
    .
    .

Next

You may have to verify the System.IO.File.ReadAllLines part.

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

You didn't answer any of my questions so I really can't add anything. What is different between when it was working and now that it's not.

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

We're into expert territory here. One endorsement coming up.

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

I used to do it the hard way too until someone else here did to me what I did to you ;D