TomW 73 Posting Whiz
If radPackageA.Checked = True Then
        dblAmountDue = 9.95

        If (dblHoursUsed > 10) Then
                dblAmountDue = 9.95 + (dblHoursUsed - 10) * 2.0
        End If
        lblTotalAmountDue.Text = CStr(dblAmountDue)

ElseIf radPackageB.Checked = True Then
        dblAmountDue = 14.95
ElseIf (dblHoursUsed > 20) Then
        dblAmountDue = 14.95 + (dblHoursUsed - 20) * 1.0

        If radPackageC.Checked = True Then
                dblAmountDue = 19.95
        Else(nonprofit) Then
                dblAmountDue = dblAmountDue * decDiscountRate
        End If

        ' Display the amount due.
        lblTotalAmountDue.Text = CStr(dblAmountDue)
End If

The only spot your adding any info back to a label is in the first part of that If statement where radPackageA.Checked = True or if A & B are both not check and Hours are greate then 20

TomW 73 Posting Whiz

You can bind a DataSet/DataTable to a Listbox and have it automatically show one field as the DisplayMember and hide the Id within its ValueMember item property.

Since you have 3 columns of information, I would suggest not even using a ListBox but instead use a DataGridView or ListView control that will allow showing all 3 columns of data. Especially considering that you said that this can be large amounts of data, I would reconsider not using a listbox.

However if you are still determined to use it, my personally suggestion would be to concatenate two of the fields you want to display into a single column and attach the additonal column to the value member.

Such as in your query

Select  IndexId, (Name + ' - ' + Value) As DisplayItm From MyTable

This will return two columns of info, then you just need to bind to your listbox

ListBox1.DataSource = myDataSet.myTable
ListBox1.DisplayMember = "DisplayItm"
ListBox1.ValueMember = "IndexId"
TomW 73 Posting Whiz
TomW 73 Posting Whiz

Comma's look fine although the double set of quotes at the end of the where clause is not needed (it shouldnt hurt anything). Also in your catch block you should include a myTransaction.Rollback

TomW 73 Posting Whiz

Each of the string/text field values should be surrounded by single quotes in your update statement. However I would suggest changing this concatenated string to use parameters instead;. it will take care of not having to surrond the values in quotes and the database wont have to parse your statement multiple times times to format it for missing parameters.

TomW 73 Posting Whiz

Use a timer....

Nattynooster commented: Sarcastic. Never used a timer before, quite new to VB +0
sknake commented: You don't deserve -rep for a good solution +5
TomW 73 Posting Whiz

Hello QBD, I understand your problem; unfortunately there is no easy solution. What you have to understand is like working directly in your database, any value changes you make to a cell dont truly take effect in that cell/record until you move to another record/row; at which time the new value is then validated and changes commited.

So even though the CellClick event may actuall fire each time its clicked (unlike most of the other events) its still not seeing that new value until you move to the next row.

The best that you can manage is checking that value when it does move to the next row in a consistent manner. The below event & sample triggers when you move to the next row, but will give you the changed value from the row you just left.

Private Sub dgv_CellValueChanged(...) Handles dgv.CellValueChanged

    Dim sbMsg As New StringBuilder

     With sbMsg
        .AppendLine(String.Format("Row Index: {0}", e.RowIndex))
        .AppendLine(String.Format("Column Index: {0}", e.ColumnIndex))
        .AppendLine(String.Format("Column Name: {0}", dgv.Columns(e.ColumnIndex).Name))
        .AppendFormat("Value: {0}", dgv.Rows(e.RowIndex).Cells(e.ColumnIndex).Value)
    End With
    MessageBox.Show(sbMsg.ToString)

End Sub
TomW 73 Posting Whiz

I have a Crystal Report which has a background made up to match a work form that needs to be filled out with data queried & processed from the database. The finished report has only five single field values and up to six detail records (three fields in each detail record). The 6 detail records need to fit into a fixed size square/box on the background form and some of the individual values fit into fixed boxes below the details section. Since the detail section grows/shrinks depending on the amount of records displayed, the whole bottom of my form is thrown off when there are less then 6 records to display.

I’ve used a few workarounds in the past such as implementing a sub-report in the details section, padding additional blank records to be displayed, and even passing every value as an individual parameter. This produced the desired results but is inefficient and slow. I need to create and send these reports directly to printing as fast as possible and looking for a better way of fixing the size so that all the values remained aligned with the form areas.

TomW 73 Posting Whiz

Your link is to Access 2003 but the original poster mentions using a different version (2007).

Access 2007 reserved words and symbols

TomW 73 Posting Whiz

I could not get it to work using the '?' as the parameter name. I had to give it an actual name; like CodeDoctor suggested above.

To comment about the above post, "Password" is not a reserved keyword in ms access.

kvprajapati commented: Don't misguide please. -3
TomW 73 Posting Whiz

Sknake is right, you need to provide the error message for anyone to provide detailed help other then guessing at whatelse might be going on in your code. For instance, I do not see where you are opening the database connection although you may be doing that elsewhere in the program.

Also is this a single user program, meaning there can be only one person with an account and login? I dont see a where clause in your update query string meaning if there is more then one account, it will update every record in that table.

kvprajapati commented: N.A -4