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?










share|improve this question






















  • 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












  • 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















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?










share|improve this question






















  • 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












  • 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













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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 at 10:57









Alexandra Macedo Lopes

63




63












  • 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












  • 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


















  • 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












  • 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
















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












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.






share|improve this answer























  • 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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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

























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.






share|improve this answer























  • 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















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.






share|improve this answer























  • 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













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.






share|improve this answer














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.







share|improve this answer














share|improve this answer



share|improve this answer








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


















  • 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


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Schultheiß

Liste der Kulturdenkmale in Wilsdruff

Android Play Services Check