Where is the custID? If it’s in (say) the RowTag for the row, then get it from there. Then pass this as an argument to a small method which stores it into a property of your EditCustomer window, then does the EditCustomer.show. That window then has the custID in that property.
would something like this work in the double pressed
' Get the selected customer ID
Dim custID As Integer = CustActiveListBox.SelectedRow.custID
' Open the EditCustomer window
EditCustomer.Show
' Pass the customer ID to the EditCustomer window
EditCustomer.Parameters.Add("custID", custID)
ok so here goes… takes me ages to type this stuff:
in my ListBox DoublePressed I have:
//Get the selected customer ID
me.RowTagAt(me.LastAddedRowIndex) = "Customer ID"
//Open the EditCustomer window
EditCustomer.Show
Then in my EditCustomer window Method I have:
//set this stuff
EditCompName.Text = ""
EditContactname.Text = ""
EditTel.Text = ""
EditMob.Text = ""
EditEmail.Text = ""
//load it into the fields (help, the 1st and second line are throwing an error)
Dim customerData As Customer
customerData = Customer.GetCustomerByID(Me.Parameters("custID").Value)
EditCompName.Text = customerData.custCompany
EditContactname.Text = customerData.custName
EditTel.Text = customerData.custTel
EditMob.Text = customerData.custMob
EditEmail.Text = customerData.custEmail
The problem is i read so much stuff online and on this forum I think I end up mixing bits of code and anything i do rarely works 1t time without intervention/help from someone else!
I think coding is not for me. I’ve been round in circles for days now. I was hoping to come back to this tread and post a working example. I’m going to give up for now. Maybe i’ll return in the future when i have more time to dedicate to it.
thank you for the help
zac
It’s no good going round in circles. You posted some error messages upthread, and then I said that you hadn’t defined your “Customer” class. That is, no wonder there were error messages. And yet you didn’t get back to us here asking what I was talking about, or anything at all. You’re not going to make progress unless, if there’s something someone has said that isn’t clear, you don’t then get back to us and ask more questions.
Thanks Tim, i do appreciate your reply. Take the Customer class as an example… I receive your help via the forum then i go off googling, rather than just firing back a question to you straight away saying “what class? how do I do that?”
I’m aware people on the forum don’t just want to write the code for me. So off i go to google where I find lots of information. Some of that info seems worth trying out. But by the time i’ve tried several different things ive got my code in a complete mess and decide to wipe it clean and start again.
I think you can imagine how easily I’m getting in a mess.
Sometime i come across a code snippet that looks like it might work, only to discover it’s old XoJo code and has been replaced!
Ive decided to revisit this again on the weekend. i’ve made a small amount of progress. Is ok to post for help on this same thread or should i start a new one please?
thank you
zac