10 Replies - 17195 Views - Last Post: 09 July 2013 - 01:09 AM Rate Topic: -----

#1 Albert Pinto  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-May 10

How to refresh a form in vb.net

Posted 03 June 2010 - 06:05 AM

Hi,

I'm using Mysql database and Visual Studio 2005. I've got a form with datagridview, After making the changes in the data, it is saved in the database. The data gets saved in the database, but the modified data does not get displayed in the datagridview. Only if I close the form and open it again, the changes are displayed. I want to provide a button (refresh-button), which on clicking will refresh the datagridview, so that the modified data is displayed without closing the form. I have heard about some refresh function, but don't know how to use it.
Any Idea............?

Please Reply.....Thanx

Is This A Good Question/Topic? 0
  • +

Replies To: How to refresh a form in vb.net

#2 walid kh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 20-April 10

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 07:02 AM

that's easy build a function that you make the code of the changing on your datagridview and call it when you need.
Was This Post Helpful? 0
  • +
  • -

#3 Albert Pinto  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-May 10

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 08:50 AM

I did not understand what you are trying to say, forget about the datagrid, just tell me how to refresh a form in vb.net.
Thanx.............
Was This Post Helpful? 0
  • +
  • -

#4 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 08:56 AM

Hi
I don't know how you insert the data since you did not provide any code, but what you can do is requery the data. (would not be good if you have lots of records, blus it makes your grid go to the first record again)

EDIT: Refreshing the Form would not help i think. Seems like the data is not in your dataset wich is bound to your grid...

This post has been edited by motcom: 03 June 2010 - 08:57 AM

Was This Post Helpful? 0
  • +
  • -

#5 Albert Pinto  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-May 10

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 11:07 AM

I am using a load button which loads all the records from datagrid to the textboxes. The data in textboxes are edited and then saved in a database. But this is not highlighted in my datagrid. But once I close the form, and then load it again, the modified data is displayed.I just want a code to refresh a form, so that my modified data can be displayed in the datagrid without closing the form.
Thanx.........
Was This Post Helpful? 0
  • +
  • -

#6 ZRonZ  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 206
  • Joined: 09-January 09

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 11:45 AM

Not sure in MySQL, but in MS SQL it's a matter of reissuing the fill statement once you've added, deleted or changed the data in the database. This basically refreshes your data in the data grid.

                'delete current record
                Try
                    Me.BindingSource.RemoveCurrent()
                    Me.TableAdapterManager.UpdateAll(Me.ataSet)
                    MessageBox.Show("Record Deleted")
                Catch ex As Exception
                    MessageBox.Show("Delete Failed")
                End Try


Was This Post Helpful? 0
  • +
  • -

#7 Albert Pinto  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-May 10

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 10:41 PM

Hi....
Please tell me how to refresh a form in vb.net.
I want to refresh a form with a button click, what is the code for doing so.
Thanx.........
Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to refresh a form in vb.net

Posted 03 June 2010 - 10:50 PM

Topics merged, please no more duplicates. Creating multiple duplicate threads isn't going to get someone to violate the rules and write your code for you.
Was This Post Helpful? 0
  • +
  • -

#9 Albert Pinto  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-May 10

Re: How to refresh a form in vb.net

Posted 04 June 2010 - 11:12 AM

Your code did not worked, but I found the solution for my problem, Thanx for your help........

View Postwalid kh, on 03 June 2010 - 06:02 AM, said:

that's easy build a function that you make the code of the changing on your datagridview and call it when you need.


Thanks 'Walid kh'..........
I now followed what u were trying to say....
Thanx a lot..........
Was This Post Helpful? 0
  • +
  • -

#10 sakthi_94  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-July 13

Re: How to refresh a form in vb.net

Posted 09 July 2013 - 01:00 AM

View PostAlbert Pinto, on 04 June 2010 - 11:12 AM, said:

Your code did not worked, but I found the solution for my problem, thanks for your help........

View Postwalid kh, on 03 June 2010 - 06:02 AM, said:

that's easy build a function that you make the code of the changing on your datagridview and call it when you need.


Thanks 'Walid kh'..........
I now followed what u were trying to say....
thanks a lot..........


Hi,

I'm having the same problem as yours. Can you help me out to solve the problem? Thanks
Was This Post Helpful? 0
  • +
  • -

#11 vks.gautam1  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 317
  • Joined: 21-March 08

Re: How to refresh a form in vb.net

Posted 09 July 2013 - 01:09 AM

guys when you are loading your data on form load . you can wrap that code in procedure and call that procedure on form load and on button click after submitting the data.

This post has been edited by vks.gautam1: 09 July 2013 - 01:10 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1