TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Goran Bibic
474
2.9k
201.2k
From one form to another multiple values C#
Oct 8 2018 6:31 AM
Form1 is opened (form name is ulaz_robe).
Form2 is list of articles (form name is artikles_search).
I need when have opened Form1 click on button to open Form2 an get data from Form2 an place in Form1 (comboboxes and textboxes).
I try this
Some help please
Solution 1
Form 1
InitializeComponent();
nazivComboBox.Text = artikl_search.naziv_artikla;
textBox2.Text = artikl_search.grupa_artikala;
jedinica_mjereTextBox.Text = artikl_search.jedinica_mjere;
cijena_bez_pdvTextBox.Text = artikl_search.cijena_bez_pdv;
kolicinaTextBox.Text = artikl_search.kolicina;
Form2
public
static
string
naziv_artikla =
""
;
public
static
string
grupa_artikala =
""
;
public
static
string
jedinica_mjere =
""
;
public
static
string
cijena_bez_pdv =
""
;
public
static
string
kolicina =
""
;
private
void
button1_Click(
object
sender, EventArgs e)
{
naziv_artikla = naziv_artiklaTextBox.Text;
grupa_artikala = grupa_artikalaTextBox.Text;
jedinica_mjere = jedinica_mjereTextBox.Text;
cijena_bez_pdv = cijena_bez_pdvTextBox.Text;
kolicina = kolicinaTextBox.Text;
this
.Close();
}
This solution dont work.
Solution 2
Form1
nazivComboBox.Text = getnaziv();
textBox2.Text = getgrupa_artikala();
jedinica_mjereTextBox.Text = getjedinica_mjere();
cijena_bez_pdvTextBox.Text = getcijena_bez_pdv();
kolicinaTextBox.Text = getkolicina();
private
String getnaziv()
{
string
value = artikl_search.naziv_artikla.ToString();
return
value;
}
private
String getgrupa_artikala()
{
string
value = artikl_search.grupa_artikala.ToString();
return
value;
}
private
String getjedinica_mjere()
{
string
value = artikl_search.jedinica_mjere.ToString();
return
value;
}
private
String getcijena_bez_pdv()
{
string
value = artikl_search.cijena_bez_pdv.ToString();
return
value;
}
private
String getkolicina()
{
string
value = artikl_search.kolicina.ToString();
return
value;
}
Form2
public
static
string
naziv_artikla {
get
;
set
;}
public
static
string
grupa_artikala {
get
;
set
; }
public
static
string
jedinica_mjere {
get
;
set
; }
public
static
string
cijena_bez_pdv {
get
;
set
; }
public
static
string
kolicina {
get
;
set
; }
Reply
Answers (
1
)
date angularjs webapi with mvc
The database or data provider you selected is not supported