Solved

how to pop a message for a change in the database?

Posted on 2014-12-12
2
269 Views
Last Modified: 2014-12-13
hi
so im using visual studio 2010, making a winform vb.net...
i have a bindingNavigator, im connecting and using database here but, i connect using visual studio tools, im not fully typing the whole thing, so, basically i used a binding navigator, and the thing is that when a certain calculation appears (through the use of timer or not) the record do get affected and i get the results i want and it will be stored,  only thing, is that when this change happens i pop a msgbox, problem is that change happens through all the records i need, but pops a msgbox only for the record that the bindingNavigator is currently on! i was thinking to loop through the datatables or something but dont know how about..

sample:
Private Sub picturebox_VisibleChanged(sender As System.Object, e As System.EventArgs) Handles picturebox.VisibleChanged

        If picturebox.Visible = True Then
            If MessageBox.Show("FIRE SAFETY, DATE NEAR, SO, A MONTH EXTENSION?", "ALMOST DUE" & vbNewLine, MessageBoxButtons.YesNo) = DialogResult.Yes Then
                FIRESAFETYTESTDateTimePicker.Value = FIRESAFETYTESTDateTimePicker.Value.AddDays(31.0)
               
            Else
                Exit Sub
            End If
        End If
    End Sub

this will take place if i navigate to (it)....through binding navigator....
any tips please?
thanks
0
Comment
Question by:ahashash
2 Comments
 
LVL 80

Accepted Solution

by:
David Johnson, CD, MVP earned 250 total points
ID: 40497931
you're not explaining it enough .. do you have a list of events stored in a database and if the date/time is within x days/hours etc you want a message to be displayed once you reach the end of the list you have to  rereadi the database because a new event may have been entered that meet your criteria.

Perhaps a better idea is a listbox that does a select * from db.event where date equals the date range.. If no events then don't show listbox. you can refresh using a timer
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 250 total points
ID: 40498245
I do not work with the BindingNavigator, because it causes side problems that are not easy to understand when they happen.

But I question the choice of the VisibleChanged event to place that code. Typically, VisibleChanged is called only once, when the form first appears on the screen. It seems odd to me that you display a MessageBox about something in the database in an event that has to do with something that deals with the fact that a control is Visible or not.

In order to change later, it's Visible property needs to be called somewhere. Is this something you do in your form? The fact that the Visible property change can also be one the side effects of using a BindingNavigator. In each case, you might need to place your MessageBox code somewhere else, or see if the code that makes the Visible property change on and on is pertinent.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question