Refresh an opened form vb.net
up vote
0
down vote
favorite
I have my form 1 and when I click in a button it opens my form 2. I want to introduce some information in this second form in order to uptade the first form.
I tried this:
Public class Form2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
... {some code here}
Form1.Refresh()
Me.Close()
End Sub
End Class
But this isn't refreshing my form1. I know I can close the first form and open it again, but i don't pretend that.
Is there any other way to do this?
vb.net forms refresh
add a comment |
up vote
0
down vote
favorite
I have my form 1 and when I click in a button it opens my form 2. I want to introduce some information in this second form in order to uptade the first form.
I tried this:
Public class Form2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
... {some code here}
Form1.Refresh()
Me.Close()
End Sub
End Class
But this isn't refreshing my form1. I know I can close the first form and open it again, but i don't pretend that.
Is there any other way to do this?
vb.net forms refresh
What exactly do you think thatRefresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain whatForm2
actually does and what exactly you expect to happen inForm1
. My guess is that you have data in a grid inForm1
and you making changes to the database inForm2
and expectingForm1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes inForm1
first, then saving them to the database from there.
– jmcilhinney
Nov 8 at 11:19
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
If you want to execute some code then you need to execute that code. CallingRefresh
is not going to do that and you should not simply assume that it will.
– jmcilhinney
Nov 8 at 11:42
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have my form 1 and when I click in a button it opens my form 2. I want to introduce some information in this second form in order to uptade the first form.
I tried this:
Public class Form2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
... {some code here}
Form1.Refresh()
Me.Close()
End Sub
End Class
But this isn't refreshing my form1. I know I can close the first form and open it again, but i don't pretend that.
Is there any other way to do this?
vb.net forms refresh
I have my form 1 and when I click in a button it opens my form 2. I want to introduce some information in this second form in order to uptade the first form.
I tried this:
Public class Form2
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
... {some code here}
Form1.Refresh()
Me.Close()
End Sub
End Class
But this isn't refreshing my form1. I know I can close the first form and open it again, but i don't pretend that.
Is there any other way to do this?
vb.net forms refresh
vb.net forms refresh
asked Nov 8 at 10:57
Alexandra Macedo Lopes
63
63
What exactly do you think thatRefresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain whatForm2
actually does and what exactly you expect to happen inForm1
. My guess is that you have data in a grid inForm1
and you making changes to the database inForm2
and expectingForm1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes inForm1
first, then saving them to the database from there.
– jmcilhinney
Nov 8 at 11:19
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
If you want to execute some code then you need to execute that code. CallingRefresh
is not going to do that and you should not simply assume that it will.
– jmcilhinney
Nov 8 at 11:42
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48
add a comment |
What exactly do you think thatRefresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain whatForm2
actually does and what exactly you expect to happen inForm1
. My guess is that you have data in a grid inForm1
and you making changes to the database inForm2
and expectingForm1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes inForm1
first, then saving them to the database from there.
– jmcilhinney
Nov 8 at 11:19
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
If you want to execute some code then you need to execute that code. CallingRefresh
is not going to do that and you should not simply assume that it will.
– jmcilhinney
Nov 8 at 11:42
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48
What exactly do you think that
Refresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain what Form2
actually does and what exactly you expect to happen in Form1
. My guess is that you have data in a grid in Form1
and you making changes to the database in Form2
and expecting Form1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes in Form1
first, then saving them to the database from there.– jmcilhinney
Nov 8 at 11:19
What exactly do you think that
Refresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain what Form2
actually does and what exactly you expect to happen in Form1
. My guess is that you have data in a grid in Form1
and you making changes to the database in Form2
and expecting Form1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes in Form1
first, then saving them to the database from there.– jmcilhinney
Nov 8 at 11:19
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
If you want to execute some code then you need to execute that code. Calling
Refresh
is not going to do that and you should not simply assume that it will.– jmcilhinney
Nov 8 at 11:42
If you want to execute some code then you need to execute that code. Calling
Refresh
is not going to do that and you should not simply assume that it will.– jmcilhinney
Nov 8 at 11:42
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48
add a comment |
1 Answer
1
active
oldest
votes
up vote
-1
down vote
Based on the input provided by you, you should fetch the data again from the database in the first form. The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
|
show 4 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
Based on the input provided by you, you should fetch the data again from the database in the first form. The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
|
show 4 more comments
up vote
-1
down vote
Based on the input provided by you, you should fetch the data again from the database in the first form. The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
|
show 4 more comments
up vote
-1
down vote
up vote
-1
down vote
Based on the input provided by you, you should fetch the data again from the database in the first form. The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
Based on the input provided by you, you should fetch the data again from the database in the first form. The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
edited Nov 8 at 13:20
answered Nov 8 at 11:14
andreas charidemou
474
474
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
|
show 4 more comments
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
An answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
– jmcilhinney
Nov 8 at 11:15
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
– Alexandra Macedo Lopes
Nov 8 at 11:21
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
Do you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
– andreas charidemou
Nov 8 at 11:30
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
– andreas charidemou
Nov 8 at 11:32
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
This should be a comment, not an answer.
– video.baba
Nov 8 at 11:33
|
show 4 more comments
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206305%2frefresh-an-opened-form-vb-net%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What exactly do you think that
Refresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain whatForm2
actually does and what exactly you expect to happen inForm1
. My guess is that you have data in a grid inForm1
and you making changes to the database inForm2
and expectingForm1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes inForm1
first, then saving them to the database from there.– jmcilhinney
Nov 8 at 11:19
@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
– Alexandra Macedo Lopes
Nov 8 at 11:36
If you want to execute some code then you need to execute that code. Calling
Refresh
is not going to do that and you should not simply assume that it will.– jmcilhinney
Nov 8 at 11:42
@jmcilhinney yes but how can I execute it from another form?
– Alexandra Macedo Lopes
Nov 8 at 11:51
How do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
– jmcilhinney
Nov 8 at 12:48