Hi there, I've been trying to find a way of transfering the data the user inputs on a form into another form (that the another user will use for consultation of data).
Here's the situation:
I'm going to just mention the sufficient for my problem, for my program is much larger than what I'm about to refer. I have 3 forms (fBanco, fContas and fCriarConta), the 1st form works as a menu where you can choose several option, which 2 of them are to create a bank account (fCriarConta) and check bank accounts (fContas).
So I have all the code I need to create the bank account, the constructors are well written, as if I leave all the field blank, I get the value "null" returned to all the textbox fields on the back account check (fContas). The problem here is that when I try to send data inputed by the user, meaning that I write on the textbox fields and when I register the bank account, the data that is sent to fContas is the same data as if I didn't write anything on the textbox fields, in other words I still get the value "null" on all textbox fields...
So I tried to check out the problem, I checked the constructors and apparently they're fine, I have 2 constructors for each class (1 doesn't receive any parameters and the other receives the variables that control the data that the user inputs on the textbox fields, thus returning them into the bank account check form (fContas)), then I checked if my If statements were creating any unforseen problems and nothing was found... finally I decided to check the forms' "classes", meaning, on my forms' code I have for the 1st (fBanco) the instance of the form fContas and fCriarConta. Why? Because if I don't instance it, I can't create objects, such as buttons that once clicked will take me to the forms I want (in this case, fContas and fCriarConta). Now even this is necessary, the problem lies here... because on the form that creates bank accounts (fCriarConta) I have a button to register the account, with the following code:
See the red colored code lines? That's where I believe my problem is. If you remember, I have already instanced the "class" fContas on my fBanco "class" and if I'm instancing it here again, the data that will always be sent through the 1st constructor and never the 2nd... (at least this is what I can understand)
I know there has to be a way to solve this...
Does anyone know how to solve it?
I'm losing my mind here x.x
Here's the situation:
I'm going to just mention the sufficient for my problem, for my program is much larger than what I'm about to refer. I have 3 forms (fBanco, fContas and fCriarConta), the 1st form works as a menu where you can choose several option, which 2 of them are to create a bank account (fCriarConta) and check bank accounts (fContas).
So I have all the code I need to create the bank account, the constructors are well written, as if I leave all the field blank, I get the value "null" returned to all the textbox fields on the back account check (fContas). The problem here is that when I try to send data inputed by the user, meaning that I write on the textbox fields and when I register the bank account, the data that is sent to fContas is the same data as if I didn't write anything on the textbox fields, in other words I still get the value "null" on all textbox fields...
So I tried to check out the problem, I checked the constructors and apparently they're fine, I have 2 constructors for each class (1 doesn't receive any parameters and the other receives the variables that control the data that the user inputs on the textbox fields, thus returning them into the bank account check form (fContas)), then I checked if my If statements were creating any unforseen problems and nothing was found... finally I decided to check the forms' "classes", meaning, on my forms' code I have for the 1st (fBanco) the instance of the form fContas and fCriarConta. Why? Because if I don't instance it, I can't create objects, such as buttons that once clicked will take me to the forms I want (in this case, fContas and fCriarConta). Now even this is necessary, the problem lies here... because on the form that creates bank accounts (fCriarConta) I have a button to register the account, with the following code:
Code:
Private Sub btnRegistar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegistar.Click
If bla bla bla bla.... Then
Dim CN as New cContaNormal()
Dim fTestForm as fContas = New fContas()
Conta.Add(CN)
RegistoActual = Conta.Count() - 1
Else
Dim CN as New cContaNormal(cbTipoConta.Text, txtNome.Text, txtSobrenome.Text, cbSexo.Text, mDataNasc.Text, txtMorada.Text, mCodPostal.Text, cbEstadoCivil.Text, cbProfissao.Text, 100.0)
Dim fTestForm as fContas = New fContas(cbTipoConta.Text, txtNome.Text, txtSobrenome.Text, cbSexo.Text, mDataNasc.Text, txtMorada.Text, mCodPostal.Text, cbEstadoCivil.Text, cbProfissao.Text)
Conta.Add(CN)
RegistoActual = Conta.Count() - 1
End If
Limpar() 'For the problem I'm having ignore this'
End Sub
I know there has to be a way to solve this...
Does anyone know how to solve it?
I'm losing my mind here x.x