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

Good thing I didn't buy anything yet. At first glance, it looks like Chromecast (about $40) is what I want. I imagine VLC will soon support it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
  • Nicely organized
  • Well laid out
  • Lots of comments
  • Good use of white space
  • Step-by-step explanation

Two thumbs up.

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

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

You started out by stating

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

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

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

I don't see the problem. You can have multiple timers with custom code for each.

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

Why not just

Public Class Form1

    Private CountDown As Integer

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

        CountDown = 15
        Timer1.Interval = 1000
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick

        CountDown -= 1

        If CountDown > 0 Then
            Me.Text = CountDown
        Else
            Me.Text = "timer expired"
            'add call to custom sub here
            Timer1.Stop()
        End If

    End Sub

    Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
        Me.Text = CountDown
    End Sub

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

Try running it in a command prompt as Administrator.

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

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

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

COUNT(*) returns the number of matching records. You don't want to include that ini the INSERT. The format of a simple INSERT is

INSERT INTO tableName
    (fldname1, fldname2, ...)
VALUES(value1, value2, ...)

While it is possible to omit the second line (the field names) this is not wise because then your INSERT values must match up one-for-one in the correct order with the fields (columns) in your table. If you add a column to the table your query breaks and you have to change your code. With parameterized queries you can code like

qry = "INSERT INTO myTable(custID, lastName, firstName) " &
      "VALUES(@cust, @last, @first)"
Dim cmd As New SqlCommand("", con)
cmd.CommandText = qry

if you are using SqlDB or

qry = "INSERT INTO myTable(custID, lastName, firstName) " &
      "VALUES(?, ?, ?)"
Dim cmd As New OleDbCommand("", con)
cmd.CommandText = qry

if you are using OleDB. Then you add the actual values with

cmd.Parameters.AddWithValue

I linked to full examples using both methods in an earlier reply.

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

I did the same thing for a browser app that I wrote. I also wanted to be able to rename the current file but I ran into problems because loading the file directly leaves the file in use. If you load the image using a filestream then the file is released.

Dim fs As New System.IO.FileStream(filename, IO.FileMode.Open, IO.FileAccess.Read)
pbxPicture.Image = System.Drawing.Image.FromStream(fs)
fs.Close()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Your recordset does not have the fields that you are trying to set. It does not know what fields are in your database table. That's why I suggested you use an INSERT instead.

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

Please post the value of dr("cstmrpic_name"). It would also help to comment out the error handling lines and identify which line is throwing the error.

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

You could tell us what line is causing the error.

Instead of doing an AddNew, do an insert query such as

sql = "INSERT INTO Applicant " &
      "       (LAST_NAME, FIRST_NAME, MIDDLE_NAME, ADDRESS, " &
      "        CLASSIFICATION, CONTROL_NO, BARANGAY) " &
      "VALUES('" & txtappln.Text & "'," &
      "       '" & txtappn.Text & "'," &
      "       '" & txtappmn.Text & "'," &
      "       '" & txtaddr.Text & "'," &
      "       '" & txtclass.Text & "'," &
      "       '" & txtcnum.Text & "'," &
      "       '" & txtbrgy.Text & "')"

con.Execute(sql)          

However, even better would be to use SqlDB (if using MS SQL) or OleDB (if using another database, then using parameterized queries instead of building the query using string concatenation. Examples of both can be found here.

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

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

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

In Rudyard Kipling's, The Jungle Book, the Bandar-log, a tribe of monkeys were considered insane by the other animals in the jungle because of their complete self-absorption, lack of discipline and outsized vanity. They would chant in unison: “We are great. We are free. We are wonderful. We are the most wonderful people in all the jungle! We all say so, and so it must be true.”

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

When someone says "I have 537 Facebook friends", what I hear is "I don't have any real friends."

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

and most merely do what they have to in order to pass to the next grade

I've read too many reports of how students are passed from grade to grade regardless of their academic qualifications. I have first-hand experience with highschool graduates who are functionally illiterate.

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

You have to put some effort in first. When you ask an open-ended question like that you might as well ask "how do I write a program". There are many online tutorials available that are easily found via google. If you don't even know how to use google (or you are not willing to go to the effort) then don't expect much help here.

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

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

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

octal 31 = decimal 25

reminds me of the anagram

eleven plus two = twelve plus one

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

I like to have a mix. I like the adjustable fonts of an ebook reader but I need a paperback when I want to read in the hot tub. I don't have a dedicated ebook reader like Kindle or Nook. I just use Calibre on my laptop.

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

Perhaps someone else fixed it because it looks fine to me now as well.

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

And what are you having a problem with? I suggest you start by reading this. It's at the top of the thread list for a reason.

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

What type of database are you using? Oracle? Access? MS SQL? MySQL?

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

I just use

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

I did an edit on this code snippet to coect the code formatting but it isn't working. What gets displayed is not what I edited. Please see the two attached snaps to compare what I edited and what is being displayed. 7c36779f2f47815b0c5537f923fa4f542555cc8080effc9e2932f8cf1f0e5661

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

Can you post the code that you are running? It would also help if you could post the value of qry after

Debug.WriteLine(qry)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

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

It's been done. See here.

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

@kent55

I think you are making this whole thing a lot more complex than it has to be. Let's start from scratch. Let's create three class level variables

Private myDict As New Dictionary(Of String, String)
Private myDefs As New List(Of String)
Private myWrds As New List(Of String)

myDict will contain both the words (key) and the definitions (values). You will populate the dictionary at the start of the app. The other two objects will contain only the words (myWrds) and only the definitions (myDefs). You will use myWrds to pick a word at random. Once that word has been used you can remove it from myWrds thereby ensuring it will not be repeated. You will never remove entries from myDict. Likewise you will leave all the entries in myDefs (because you will want to pick random incorrect definitions for the quiz).

Note that you do not have to randomize the entries in any of the lists because you can just pick a random entry by generating a random index into the list.

You read the entries into myDict once in a loop. After reading myDict you can create the other lists by

myWrds = myDict.Keys.ToList
myDefs = myDict.Values.ToList

You pick a random word by

Dim wrd As String = myWrds(rnd.Next(0, myWrds.Count))

After you pick a word you remove it from myWrds. The next step is to create a list of three definitions, one of them being the actual definition (from myDict) and the other …

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

Too many ads.

Too little privacy.

Too high a ratio of crap to content.

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

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

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

Oh wah ta na Siam.

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

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

That's the trouble with TNBT (the next big thing). The world seems to oscillate between hype and boredom. We get TNBT and that's all you hear about for a few months or possibly a few years. Then TNBT comes along with new hype and all you hear about TLBT (the last big thing) is "that's so yesterday". Now that everybody and their dog has a Facebook page (even grandparents for crying out loud) the "cool" people are abandoning it.

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

This one's for Mike...

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

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

Let's say you have the field, id, as the only field in both tables. The query

INSERT INTO tb2 
    SELECT id FROM tb1 
     WHERE id NOT IN (SELECT id FROM tb2)  

will do what you want.

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

I confess. I do not have a clue what your code is doing.

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

Post the code you are using now.

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

You insist on posting code without asking a question. Because you seem to be unwilling to go to the effort of explaining yourself, I refuse to put in any more effort.

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

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

Can we get off the guns now?

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

This Arlo and Janis cartoon nails it.

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

Your declaration should be

kv = New Dictionary(Of String, String)

You should probably be using something like "=" for a separator because a comma might appear in a definition.

If you use a common handler for the radio buttons you won't need to use a complex If statement. For example

Private Sub radDef1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radDef1.CheckedChanged, radDef2.CheckedChanged, radDef3.CheckedChanged

    Dim rad As RadioButton = sender

    'Because this event triggers when a radiobutton is
    'deselected as well as selected, we only want to process
    'the SELECTED event. Also, one radio button will be
    'selected automatically. If you start with the label
    '(which displays the word) being blank then you can
    'ignore the initial SELECTED even on form load.

    If rad.Checked And lblWord.Text <> "" Then
        If rad.Text = myDict(lblWord.Text) Then
            'the answer is correct
        Else
            'the answer is incorrect
        End If
    End If

    'remove the word from the quiz (dictionary)

    'if there are more words left then
    '   display the next question
    'else
    '   the quiz is over
    'end if

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

I am assuming that the Sub, Recordset, does what I expect. You didn't provide the code so I can't tell for sure.

Dim qry As String

qry = "SELECT COUNT(*) AS numRecords " _
    & "  FROM Commi_Cus " _ 
    & " WHERE Sha_no = " & txtShaha

Call Recordset(rsview, cnview, qry)

Dim numrec As Integer = rsview("numRecords").Value

If the database field is non-numeric then you should use

qry = "SELECT COUNT(*) AS numRecords " _
    & "  FROM Commi_Cus " _ 
    & " WHERE Sha_no = '" & txtShaha & "'"
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

@mike said

one of the primary uses for firearms is to commit suicide

@jwenting said

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

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

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

The constraint

Constraint employee_FK foreign key (EmployeeSupervisorID)REFERENCES Employee_T(EmployeeID)

prevents you from adding a record unless EmployeeSupervisorID already exists. How, exactly, do you add the supervisor to the table? The constraint will prevent you from adding the supervisor until you add his/her supervisor first? Of course, it's 3:00 am and I may be missing something.

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

You could do

Dim qry As String = "SELECT COUNT(*) AS numrec FROM Applicant" &
                    " WHERE LAST_NAME  = '" & txtappln.Text & "'" &
                    "   AND FIRST_NAME = '" & txtappfn.Text & "'" &
                    .
                    .
                    .
rs.Open(qry, con, 2, 3)

If rs("numrec").Value = 0 Then
    'the record does not exist
Else
    'the record exists
End If

This assumes you are using ADODB. To see how to do this using OleDb with parameters (which you should be doing) please see here.

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

Please post the SQL code to create the database.

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

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

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

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

they screwed up networking with home-groups

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

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

You start by reading the manual. If you do not know how to create a database then you have not bothered to do any reading. Thirty seconds of googling will give you the answer.

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

That's your code that doesn't work. There is nowhere in my code where you will find

If txtShaha = .Fields!Sha_no Then

There is no need for the If statement. Doing a SELECT COUNT will always return a value unless the statement causes an error (for example, if the table does not exist).

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

I see a large number of queries in a large block of undocumented code. What are you trying to do in one query?

B y the way, because you are doing multiple queries using the same connection it is better to open it at the start, then close it once all the queries are done.

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

I am prepared to name you a dozen or so examples of poll intimidation and vote rigging by Republicans in recent years. I presume your "Black Panther" reference was implying that Democrats have done the same. If you cannot cite examples then please refrain from making unsubstantiated accusations.