15,919,341 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 7733425 (Top 4 by date)
Member 7733425
26-May-11 23:37pm
View
Hi losmac,
Here is the code I used to query a PayrollEntry table, and then used that information to insert a new row or rows into the PayrollHistory database table.
Bob
Private Sub btnPayPostRow_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnPayPostRow.Click
'UpDate DataBase or Exit?
' Display a message box asking users if they want to continue
' Configure message box
Dim message As String = "Do you wish to continue to post these rows?"
Dim caption As String = "Posting to Payroll History"
Dim buttons As MessageBoxButton = MessageBoxButton.OKCancel
' Show message box
If MessageBox.Show(message, caption, buttons) = MessageBoxResult.Cancel Then
MessageBox.Show("Posting has been cancelled")
GoTo Aborted
End If
'Declare varitables for PayrollEntry table
Dim strDate As String = ""
Dim strSSNum As String = ""
Dim strLName As String = ""
Dim strPScale As String = ""
Dim strJobNum As String = ""
Dim strRHrs As String = ""
Dim strOHrs As String = ""
Dim strDHrs As String = ""
'Query the ROWS to be posted in PayrollEntry table
Dim payEntry = From payR In dc.PayrollEntries
Select payR
Me.PayrollEntryDataGrid.ItemsSource = payEntry
For Each payR In payEntry
strDate = payR.DateOf
strSSNum = payR.SocialSecurityNum
strLName = payR.LastName
strPScale = payR.PayScale
strJobNum = payR.JobNumber
strRHrs = payR.RegHrs
strOHrs = payR.OTHrs
strDHrs = payR.DTHrs
'Insert row into PayrollHistory
Dim newPayrollHistory = New PayrollHistory With {.DateOf = strDate, .SocialSecurityNum = strSSNum, .LastName = strLName, .PayScale = strPScale, .JobNumber = strJobNum, .RegHrs = strRHrs, .OTHrs = strOHrs, .DTHrs = strDHrs}
dc.PayrollHistories.InsertOnSubmit(newPayrollHistory)
dc.SubmitChanges()
Next
MessageBox.Show("All the rows has been inserted into PayrollHistory")
Aborted:
End Sub
Member 7733425
24-Mar-11 17:09pm
View
Hi Stanz,
I Thank you for your information, but the first link only uses Windows forms and list views, and the second only uses WPF and list views that contain a datagrid – not the new Datagrid that is used by itself. What I am interested in doing is building projects using the new way of doing Windows, by combining the two separate platforms of WPF with the new WPF Datagrid, and Entity Framework (especially the LINK to Entities method) all using the VB language.
Bob
P.S.
I have made some changes to my first reply to you, and don't be sorry because I couldn't use the links you mentioned because I really appreciate your help! I'm especially going to look at the site you mentioned below about converting C# into VB, thanks again,
Bob
Member 7733425
20-Mar-11 20:56pm
View
Hello again Henry Minute,
My friend, this link to msdn. . . . . . /gg610409 is just the information I have been looking for, I can’t thank you enough. There is a Visual Basic download available at the top of the article that I downloaded and successfully run. The only thing I cannot get it to do is to save the changes or editing of the datagrid back to the database. I have asked Julie if she could tell me why, but I haven't heard from her yet. I will also look at the other links you so graciously provided to see if they can be of further help.
I was also surprised and pleased that this article was written by Julie Lerman whose book I already have. I have read through Julie’s book, and it touches on many of the subjects and objects I’m interested in, but it never goes into specific detail on how to use WPF datagrid and Entity Framework to edit and update the database. The article does, and step by step explains why and how; it’s the best and clearest information I have ever read, and I have you to thank for it.
Bob
Member 7733425
20-Mar-11 0:21am
View
Hi Henry Minute,
I want to thank you taking the time to direct me to this walkthrough, I had seen it before but had not taken the time to examine it. It is an interesting project showing the use of more than one page, and it does use WPF and the datagrid, but only in a basic way. What it doesn’t show is how to use it in conjunction with Entity Framework to edit and manipulate the WPF datagrid, and then update it to the database. But I do appreciate your response!
Bob