Question Thrown In At The Deep End

PhillD

Well-known member
Joined
Mar 5, 2010
Messages
91
Programming Experience
10+
I am really hoping someone can help me. I am a complete noob to VB 2008 though I have worked with MS Access, VBA and VB for 15 years.

I have been asked to write a system for employee to enter expenses. I’ve setup 2 tables in SQL, first the ExpenseHdr for employee, date etc… then ExpenseLines for the expense items to be added. I’ve setup primary Keys and a cascade update delete relationship between the ExpenseID which is stored in both tables.

I used the data sources tab and was able to create a Parent and Child grid and have them working perfectly!

Here’s the kicker. When they enter their Employee ID number into the employee ID box, I need VB 2008 to check if they have an open expense ticket and load it in the form. We cannot allow the user to browse through all of the other employees expenses so I have deleted the browse buttons.

To fix this, I edited the table adapter’s fill and GetData method with EmployeeID = @EmployeeID, however, when I load the form I receive the error: Argument not specified for parameter 'EmployeeID' of 'Public Overridable Overloads. It’s obvious why I’m getting the error because I can’t figure out how to set @EmployeeID in code. I could do this so easily in Access and VB but it seems illogical .NET. I am almost of the opinion that I should hand code the data management.

I also have a second problem. When the user clicks new record, they are given an Auto Increment Expense ID number by VB. This is being picked up from the Expense ID field in the database. The problem is that it’s not the real ID the ticket will be assigned when it is saved. If another user saves a record first, they will steal the ID number and the first user’s ID number will be changed when the save button is pressed. That is poor! I understand why it occurs but VB should prevent it. You cant issue an ID number to a user and then change it later. Do I need to create a blank record in the DB first and then UPDATE the data back to the DB?

I almost wish I had no programming knowledge because I am stuck in an MS Access and VB mindset and are having problems scaling back the things I used to be able to easily program. Someone please help me.
 
I did watch that video, but it added an automated search tool bar strip, I did not see how to get to the code behing it. Similar to the delete button on the binding navigator, I wanted to see the code behind the click event but when I looked, there was nothing there.
 
Doubleclick the search button to get to the generated search code, it's a single FillBy call in Click event handler.

BindingNavigator Class (System.Windows.Forms) here you can see the mapping between the navigator and the BindingSource. For example, the navigator by default has mapped DeleteItem property to the 'delete' button, when clicked this calls the BindingSource.RemoveCurrent method, there is no user code for this.
 
Thanks for the help. I really do appreciate it. I will try it as soon as I can, unfortunately, for the next few days, I am covered up with tech work. Anybody need a programming job?, please let me know, I am hiring. We are based out of Midland, TX
 
Back
Top