Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-12-12
2
Medium Priority
?
275 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 84

Accepted Solution

by:
David Johnson, CD, MVP earned 1000 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

927 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