16,013,338 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 .NET 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 13954123 (Top 8 by date)
Member 13954123
22-Apr-19 15:26pm
View
It is a WindowsForm App.
Maybe I made some mistake, because the original app (C#) I mentioned is WPF, and my VB.NET application is WinForm. I was a little confused about which properties have the same meaning in the WinForm, since is no exactly the same names.
Member 13954123
22-Apr-19 13:52pm
View
I think so. I have set just like your example.
dateDropDown.DataSource = payments '.ItemsSource = payments
dateDropDown.DisplayMember = "DatePayment" '.DisplayMemberPath = "Date"
dateDropDown.ValueMember = "Id"
But I also set the client combobox to:
ClientDropDown.ItemsSource = clients
ClientDropDown.DisplayMemberPath = "Name"
ClientDropDown.SelectedValuePath = "Id"
Maybe is this the cause?
Member 13954123
22-Apr-19 12:41pm
View
I am not understanding why the message error refers to CLientModel. The code seems to be referring to the PaymentModel as I look.
Member 13954123
22-Apr-19 12:32pm
View
Actually I haven't tried these options before reading your comment.
Did (1), and it works when passing a number instead of the "ClientDropDown.SelectedValue".
In (2), the code fail in the line 25 of my SQLiteDataAccess Class, which is the line that use the parameters passed (@ClientId, Value) to access the DataBase. The Id is not being passed correctly from the dropdown.
10Public Class SQLiteDataAccess
11 'generic code to load data
12 'LoadData<personmodel>("Select * from Person", null) = List<personmodel>
13 Public Shared Function LoadData(Of T)(ByVal sqlStatement As String, ByVal parameters As Dictionary(Of String, Object), ByVal Optional connectionName As String = "Default") As List(Of T)
14
15 Dim p As DynamicParameters = New DynamicParameters()
16 'DynamicPirameters is a Dapper Type
17
18 For Each param In parameters
19 '@FirstName, "Tim"
20 p.Add(param.Key, param.Value)
21 Next
22
23
24 Using cnn As IDbConnection = New SQLiteConnection(DataAccessHelpers.LoadConnectionString(connectionName))
25 Dim rows = cnn.Query(Of T)(sqlStatement, p)
26 Return rows.ToList()
27 End Using
28
29 End Function
30
Member 13954123
22-Apr-19 11:22am
View
payments is declared in the beginning of the code as
Private payments As ObservableCollection(Of PaymentsModel) = New ObservableCollection(Of PaymentsModel)()
Member 13954123
22-Apr-19 11:16am
View
I found this strange too. This may be the problem. The variable ClientID is in the PaymentModel. I will check it.
Member 13954123
22-Apr-19 11:14am
View
I copied the entire block that includes these two lines.
127 Private Sub ClientDropDown_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ClientDropDown.SelectedIndexChanged
128 Label2.Visible = True
129 dateDropDown.Visible = True
130 OrTextBox.Visible = True
131 newButton.Visible = True
132
133 LoadDateDropDown()
134 End Sub
135
136 Private Sub LoadDateDropDown()
137
138 Dim sql As String = "select * from Payment where ClientId = @ClientId"
139 Dim parameters As Dictionary(Of String, Object) = New Dictionary(Of String, Object) From {
140 {"@ClientId", ClientDropDown.ValueMember}'SelectedValue}
141 }
142
143 Dim records = SQLiteDataAccess.LoadData(Of PaymentsModel)(sql, parameters)
144 payments.Clear()
145 records.ForEach(Sub(x) payments.Add(x))
146 End Sub
Member 13954123
22-Apr-19 9:58am
View
It is Integer
Show More