Solved

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

Posted on 2014-12-12
2
257 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 78

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now