Solved

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

Posted on 2014-12-12
2
264 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 79

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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 …

809 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