Working with database on multiple forms


hello!

i'm having issues regarding database , multiple forms. let me explain situation first:

my previous software worked fine, , on 1 form, other 'windows' becoming visible , invisible needed it. thing is, user didn't like... well, neither liked hehe. started developing 'windows' in new forms, didn't work well.

i have 3 forms, main 1 user can see projects have, dragged components database needed display (it worked on 'only-one-form-project'), 'form2' user register projects , third 1 edits details of the project.

so, main form contains 3 datagridviews, side-by-side, each 1 different contents user project, , dragged database, , that's lays down problem. see, 'only-one-form-project' able update these datagridviews edited other 'windows' (by pressing save button). now, other forms, can't it.

the database saves data, because when reopen other forms, edited data there, although doesn't update in gridviews.

i've dragged same components database on both projects (the only-one-form , multiple forms), works on only-one-form , can't figure out solution. can assume because on different forms.

here's code snippets:

//the main form public partial class principal : form { /* variables here */ //the declaration of other forms form3 config = new form3(); form2 cadastro = new form2(); public principal() { initializecomponent(); } //when loads main form, fill each of datagridviews private void form1_load_1(object sender, eventargs e) { this.funcaotableadapter.fill(this.database1dataset.funcao); this.estadostableadapter.fill(this.database1dataset.estados); this.modulostableadapter.fill(this.database1dataset.modulos); this.projetotableadapter.fill(this.database1dataset.projeto); windowstate = system.windows.forms.formwindowstate.maximized; timer1.start(); } //this! save method used.

//it worked fine on 'only-one-form-project' , yesterday

//i able call method other forms.

//but, well, though called it, datagridview didn't show new data public void salva_banco() { validate(); projetobindingsource.endedit(); modulosbindingsource.endedit(); funcaobindingsource.endedit(); estadosbindingsource.endedit(); tableadaptermanager.updateall(database1dataset); } //it had 'this.' before each statement, tried removing it.. well, didn't work also. //the other forms //this how call save method: var principalform = application.openforms.oftype<principal>().single(); principalform.salva_banco(); //i've added breakpoints see if calls method, , does.


well, haven't remove other 'windows', mean, when open form2 opens old edit window on main form. i've tried remove it, seems problem continues, perhaps left behind. if help, happy.

any doubts how program works, ask.

ps.: i've tried upload images, ms said need verify account... lot ms, hehe.

thanks!


hi gianbraghini,

are there errors thrown application? if there are, lines throw errors , errors?

it's hard find out what's wrong application based on description. suggest put project file on skydrive, , give link of file. maybe can testing code.


caillen
msdn community support | feedback us
develop , promote apps in windows store
please remember mark replies answers if , unmark them if provide no help.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'