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

Are there any rules being applied by Outlook that might be automatically moving the messages to other folders? Possibly junk mail filters?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
txtoutput.Text = txtFirstNum.Text  & " + " & _
                 txtSecondNum.Text & " = " & _
                 (CInt(txtFirstNum.Text) + CInt(txtSecondNum.Text)).ToString
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have to convert the strings to their integer equivalents with CInt as in

num1 = CInt(txtFirstNum.Text)

But you should first check that the string is a valid number by

If IsNumeric(txtFirstNum.Text) Then
    num1 = CInt(txtFirstNum.Text)
Else
    MsgBox("First Number (" & txtFirstNum.Text & ") is not a number")
End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Should I do it initially right after I do the DataAdapter.Fill statement, which is followed by a DataGridView.DataSource?

I'm afraid I can't help you with that part. I have no experience using DataAdapters. All my experience is with ADO.net. I also used dates as folder (or file) names or prefices, however I used the format YYYY-MM-DD so the translation to date (because our system date format was also YYYY-MM-DD) was trivial.

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

Righto about the typo. I corrected it. If you store dates as strings instead of native date values then you can't use the SQL date functions in queries. Also, as you point out, dates can be stored n less space than the equivalent strings. Comparisons will not work depending on how you format the dates if stored as strings. For example

SELECT * FROM myTable WHERE thedate > GETDATE()

GETDATE() returns the current date. The query doesn't work if "thedate" is not a DATE value. If you really insist on storing dates as strings then comparing two date fields will be meaningless if your format isn't YYYY-MM-DD or YYYY/MM/DD or any format where year is first, followed by month, then day and month and day are always two digits.

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

The cottage is a seven hour drive so we go out mid May and usually return mid September. Came back a little early this year for family reasons.

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

Been home from the cottage since the end of August. Remember that snowstorm a week ago? We were raking leaves in the middle of it. Should have waited (like I wanted to) for the nicer weather that eventually came back.

Stuugie commented: Another Up-Vote for your help. Thanks! +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Hey Stuggie, how are you enjoying this crappy fall weather?

Try replacing 'm' with just the word, month as in

select DATEPART(month,release_date) from etc
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try putting "#" around the date fields. Access prefers dates in the form

INSERT INTO mytable (SYSDATE) VALUES(#2012-10-31#)

That would make the last two lines of your query

"#" & ds.Tables(0).Rows(iRows).Item(5) & "#," & _
"#" & ds.Tables(0).Rows(iRows).Item(6) & "#)"

If MODE is a text field then you'll also have to put single quotes around it. If this doesn't work then please print out the value of cmd.CommandText and post it here.

/EDIT - I corrected the typo ($ to #) as pointed out in the next post.

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

Or you can handle it in the KeyUp handler as follows:

Private Sub TextBox1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
    If e.KeyCode = Keys.Enter Then
        If Not IsDate(TextBox1.Text) Then
            MsgBox("not a date")
            e.Handled = True
        Else
            'update the database
        End If
    End If
End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I created an Access database with the table

users
    username (Text primary key)
    password (Text)

Then I executed the following query

INSERT INTO users (username, password) VALUES ('Frank','shalom')

It inserted with no errors. Perhaps the problem is with your database or the connection string.

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

It is possible that either txtUser1.Text or txtPass1.Text contains a character that is screwing up the statement. For example, if the username is "O'Neal" and the password is "froggie" then the resulting insert statement is

INSERT INTO Users (Username, Password) VALUES ('O'Neal','froggie')

build the query in a string and display it before executing it. If the problem isn't obvious then post the query string back here.

/EDIT

This is what happens when I get interrupted in the middle of an answer. Obviously you are already building the query in a variable. But displaying the contents will help clear up the problem.

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

If

My.Computer.Audio.Play(My.Resources.alarm, AudioPlayMode.BackgroundLoop)
MsgBox(MessageBox.Text)
My.Computer.Audio.Stop()

works then

If cbxAudibleAlarm.Checked Then
    My.Computer.Audio.Play(My.Resources.alarm, AudioPlayMode.BackgroundLoop)
End If

MsgBox(MessageBox.Text)

If cbxAudibleAlarm.Checked Then
    My.Computer.Audio.Stop()
End If    

should also work

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

It's possible. For sample code please see this thread.

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

Yes. l = level. Force of habit from my APL days. That was an oops. Lower case L should never be used as a variable name because it looks so much like a one (same rule for O (oh) and 0 (zero)). My bad. Also, r = row and c = column. You can't specify repeaters in this type of initialization but you could always put in a dummy value then use a loop to set the real values later. Or you could use consts as in

Const E01 As Integer = 999

Dim a(,,) As Integer = {
    {{E01, 102, 103}, {104, 105, 106}, {107, 108, 109}},
    {{E01, 202, 203}, {204, 205, 206}, {207, 208, 209}},
    {{E01, 302, 303}, {304, 305, 306}, {307, 308, 309}}}
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The following code initializes a 3x3x3 array then prints out the values.

Dim a(,,) As Integer = {
    {{101, 102, 103}, {104, 105, 106}, {107, 108, 109}},
    {{201, 202, 203}, {204, 205, 206}, {207, 208, 209}},
    {{301, 302, 303}, {304, 305, 306}, {307, 308, 309}}}

For l As Integer = 0 To 2
    For r As Integer = 0 To 2
        For c As Integer = 0 To 2
            Debug.Write(a(l, r, c) & " ")
        Next
        Debug.WriteLine("")
    Next
    Debug.WriteLine("")
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You put a checkbox on the form and in the timer event you do

If cbxAudibleAlarm.Checked Then
    My.Computer.Audio.Play(My.Resources.alarm)
End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

To calculate the new position of the label, subtract half the width of the label from half the width of the panel as in

Label1.Location = New Point(Panel1.Width / 2 - Label1.Width / 2, Label1.Location.Y)

By default, labels are set to autosize so if you do this calculation when the text changes then the label should stay centered.

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

I would define a class level variable to hold the countdown value.

Private countdown As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim btn As Button = sender

    If btn.Text = "Start Timer" Then
        countdown = 100
        btn.Text = "Stop Timer"
        TimerState.Text = "Active"
        Timer1.Enabled = True
    Else
        btn.Text = "Stop Timer"
        TimerState.Text = "Inactive"
        Timer1.Enabled = False
    End If

End Sub

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

    countdown -= 1
    txtTimer.Text = timeout

    If countdown = 0 Then
        timer1.Enabled = False
        My.Computer.Audio.Play(My.Resources.alarm)
        MsgBox(MessageBox.Text)
        TimerState.Text = "Expired"
    End If

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

The button click event should only start/stop (toggle) the timer. The timer tick handler is where you do the decrementing, testing and end-processing. If the timer interval is set to 1000 then it will "tick" once a second. The processing in the tick handler would be

decrement the countdown value
update the displayed value

if countdown value is zero then
    timer1.Disabled = True
    My.Computer.Audio.Play(My.Resources.alarm, AudioPlayMode.BackgroundLoop)
    MsgBox(MessageBox.Text)
    TimerState.Text = "Expired"
end if
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

So far I haven't seen any effort on your part other than the effort it took to type in the post.

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

If you have a specific question perhaps we can help but we are not going to do your research for you.

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

You can use the Year property of a date to get the year number and compare it to the current year.

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

Is there a way to get around some records being null in certain columns?

As long as the fields (including missing ones) are delimited by tabs then my code will work.

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

That's the one. We just watched Redline. The resolution on the video was 1864x1048. No plot, lots of action and I can't believe it was animated by hand.

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

Depending on what the underlying database is, there are functions which wull replace DBNULL with a valid value. For example, in MS SQL you can use the COALESCE function as follows

SELECT lname, fname, COALESCE(mname,"(none)") FROM myTable

This will return values for all three fields, even when there is no middle name entered. In that case, the value returned for mname is "(none)".

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

My son said to ask if you've heard of (or seen) Wolfen Spice.

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

It depends on your definition of loop. For example, if you create a detached recordset and read the integer values into it, you could then use the Sort method to rearrange the values. Your program would use no loops (as long as you brute-forced the input), however, the Sort method would undoubtedly have a loop hidden inside. Same thing with using QuickSort.

Although, strictly speaking, your problem definition does not mention sorting (only the thread title does). Your actual problem definition says you only have to read and write the numbers.

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

I think the problem is that he wants to define a field value for each field (null if the field is not present). One obvious problem is what happens when it's not the last field that is missing.

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

You could try

For Each line As String In System.IO.File.ReadAllLines("d:\temp\test.txt")

    Dim col() As String = {"", "", "", "", ""}
    Dim fld() As String = line.Split(vbTab)

    For i As Integer = 0 To UBound(fld)
        col(i) = fld(i)
    Next

    For i As Integer = 0 To UBound(col)
        Debug.WriteLine(" field " & i & " = " & col(i))
    Next

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

I attached a sample project that implements a command shell inside a Windows form. I hope this helps.

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

The colon allows you to put multiple lines of code on one line. It's usually frowned upon but I find there are certain circumstances where is compresses the number of lines of code and improves readability. IIF is a oneline If Then Else used in assignments where the syntax is

var = IIF(boolean expression, True value, False value)

In my example, if the hours value is outside the acceptable range then assign an error string, else assign an empty string.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Dim hr As Integer = CInt(textboxAm.Text)
Dim msg As String = ""

Select Case Lcase(ComboBox1.Text)
    Case "monday"
        If hr < 8 Or hr > 12 Then 
            msg = "monday min is 8 and max is 12"
        End If
    Case "friday"
        If hr < 12 Or hr > 24 Then 
            msg = "friday min is 12 and max is 24"
        End If
    Case "saturday"
        If hr < 20 Or hr > 24 Then 
            msg = "saturday min is 12 and max is 24"
        End If
End Select

If msg <> "" Then
    MsgBox(msg & "...please correct and continue")
End If

or

    Dim hr As Integer = CInt(textboxAm.Text)
    Dim msg As String = ""

    Select Case LCase(ComboBox1.Text)
        Case "monday" : msg = IIf(hr < 8 Or hr > 12, "monday min is 8 and max is 12", "")
        Case "friday" : msg = IIf(hr < 12 Or hr > 24, "friday min is 12 and max is 24", "")
        Case "saturday" : msg = IIf(hr < 20 Or hr > 24, "saturday min is 12 and max is 24", "")
    End Select

    If msg <> "" Then
        MsgBox(msg & "...please correct and continue")
    End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In that case you add a switch to sort to specify the starting column number as in

tasklist /nh | sort /+30
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the GUI, click on that column. If you are running it from the command line then

tasklist /nh | sort
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not a C++ programmer (although I have done a fair bit of development in C), but I think you will have an easier time developing the code in Python. Because your GUI is fairly simple perhaps I will recant my earlier warning and suggest you develop the GUI first with stubs for the rest. You can always post questions in the Python forum if you are having problems with the GUI. To be fair, my experiences with Python GUIs were with the wxPython package and my main problem was with the resizers which you may not need. As an assembler programmer you are obviously not afraid to get your hands dirty.

BigPaw commented: Jim read Though and around my problem, and then followed up with well considered suggestions. I reached a positive solution with Jims help. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

At the risk of offending pyTony, I'd say avoid Python simply because of the problems building the GUI. I find Python to be an excellent (even elegant) language, but I found that building a GUI was excrutiatingly painful. For someone who is already familiar with Python I'd say go ahead but not for someone who is a newbie to it. I can't speak for C++ but if you are using an IDE such as Visual Studio I'd say go ahead with C++ or Visual Basic.

By the way, if you indent a line (tab or four spaces) the editor treats it as code (which is automatically numbered). If you don't indent the line then it is treated as straight text. You can click on formatting help at the top right of the edit window for help.

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

You can remove the bu by apt.Replace("/bu","")

As for 23c, unfortunately with either code it will be taken as part of the street name unless you change the code that detects the street number from "first all numeric field" to "first field that starts with a digit".

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

In both cases, once you have the street portion, the remainder is STREET# and APT#. You could do the switch based on the detection of the first numeric field. Anything following that is the apartment number.

    Dim street As String = ""
    Dim number As String = ""
    Dim apt As String = ""
    Dim foundnum As Boolean = False

    For Each token As String In TextBox1.Text.Split()
        If IsNumeric(token) Then
            If foundnum Then
                apt = token
            Else
                number = token
                foundnum = True
            End If
        Else
            If foundnum Then
                apt = token
            Else
                street &= " " & token
            End If
        End If
    Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can you give me an example of both formats?

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

It's actually my son who is the Anime pro of the family. I'll pass on your suggested site to him. Thanks.

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

You might want to have a look at this site

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

Assuming you want to display seconds, create a timer on the form, set the interval to 1000 (one second in milliseconds), then in the timer event handler, write the current time into a label. Make sure you set the Enabled property of the timer to True at some point (form load perhaps) to start the time update.

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        lblTime.Text = TimeOfDay
    End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Your original code checks to see if you have a line in the ListBox consisting of

ID & ", " & AName & ", $" & ABalance

If the line doesn't exist you can add it by

AccountsListBox.Items.Contains(ID & ", " & AName & ", $" & ABalance)

If it does exist, what do you want to replace it with?

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

The following code will replace the record that matches "Fred 17" with the new text if it exists in the ListBox.

Dim text As String = "Fred 17"
Dim ind As Integer = ListBox1.Items.IndexOf(text)

If ind >= 0 Then
    ListBox1.Items(ind) = "Jim 29"
Else
    'add the text
End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You use My.Computer.Registry.GetValue. For example

Dim key As String = "HKEY_CURRENT_USER\Software\Helios\TextPad 5\Recent File List"
Dim name As String = "File3"

MsgBox(My.Computer.Registry.GetValue(key,name,Nothing))
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As a first approximation

        Dim street As String = ""
        Dim number As String = ""
        Dim apt As String = ""
        Dim foundnum As Boolean = False

        For Each token As String In TextBox1.Text.Split()
            If IsNumeric(token) Then
                If foundnum Then
                    apt &= " " & token
                Else
                    foundnum = True
                    number = token
                End If
            Else
                street &= " " & token
            End If
        Next

        TextBox2.Text = "STREET: " & Trim(street) & vbCrLf &
                        "NUM:    " & Trim(number) & vbCrLf &
                        "APT:    " & Trim(apt)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you say so. From what I know of xml/html that is not standard. Values go between tags and attributes go inside double quotes.

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

It seems to me you are trying to use a reserved character "/" in a place where it doesn't belong. I would think the proper syntax would be

<directory>/</directory>

or possibly

<directory dir="/">

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

Can you manage the code for that by yourself?