Hello all, I am still having an issue where multiple Message Boxes are
being displayed to the user from the same form at one time. This issue
hides the boxes behind the forms since the forms take up the whole
desktop most of the time when maximumized and also the boxes are only
reachable when ALT is used. Once the multiple OK buttons are clicked
the application freezes up and needs to be restarted.
I have posted this before and the general response is
"MessageBox.Sho w() stops all code from being called until the user
clicks OK" - while in this situation, something happens that allows the
code to be looped through again while the OK Message Box is displayed
on screen BEFORE the OK is clicked which then shows a second Message
Box from the same form.
See for yourselves: http://img456.imageshack.us/img456/3747/untitled3dx.png
This small example application has displayed 2 Message Boxes, if this
were a larger sized program then the second box which needs to be
clicked OK first would be behind the whole program and only reachable
through ALT TAB or clicking on it in the taskbar. How is this
possible?!?! 12 1926
jburkle,
Code?
Kerry Moorman
"jburkle" wrote: Hello all, I am still having an issue where multiple Message Boxes are being displayed to the user from the same form at one time. This issue hides the boxes behind the forms since the forms take up the whole desktop most of the time when maximumized and also the boxes are only reachable when ALT is used. Once the multiple OK buttons are clicked the application freezes up and needs to be restarted.
I have posted this before and the general response is "MessageBox.Sho w() stops all code from being called until the user clicks OK" - while in this situation, something happens that allows the code to be looped through again while the OK Message Box is displayed on screen BEFORE the OK is clicked which then shows a second Message Box from the same form.
See for yourselves: http://img456.imageshack.us/img456/3747/untitled3dx.png
This small example application has displayed 2 Message Boxes, if this were a larger sized program then the second box which needs to be clicked OK first would be behind the whole program and only reachable through ALT TAB or clicking on it in the taskbar. How is this possible?!?!
- .....
-
-
Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
-
eventArgs As System.EventArgs) Handles cmdRenew.Click
-
-
Try
-
If x Is Nothing Then
-
Exit Sub
-
End If
-
If y > 0 Then
-
If z = 0 Then
-
MsgBox("Random Message")
-
Exit Sub
-
End If
-
Else
-
Exit Sub
-
End If
-
If a Then
-
MessageBox.Show("Random Message")
-
Exit Sub
-
End If
-
If (b Or c) Then
-
MsgBox("Random Message")
-
Exit Sub
-
Else
-
If d Then
-
...
-
If e Then
-
MsgBox("Random Message")
-
Exit Sub
-
End If
-
Else
-
If f Then
-
...
-
If g Then
-
MsgBox("Random Message")
-
Exit Sub
-
End If
-
Else
-
MsgBox("Random Message")
-
Exit Sub
-
End If
-
End If
-
End If
-
-
''Problem Here
-
-
If (h = 123) Then
-
MsgBox("This Message Displays to the User while Done!
-
MessageBox is also being Displayed")
-
Exit Sub
-
End If
-
If i <> "" Then
-
...
-
If j Then
-
MsgBox("Random Message")
-
Exit Sub
-
End If
-
If k Then
-
...
-
Else
-
If l Then
-
...
-
Else
-
...
-
End If
-
End If
-
-
''Gets to here
-
Call DoStuff() ''inside this, "h" set to 123
-
MessageBox.Show(me,"Done!", "", MessageBoxButtons.OK)
-
Else
-
MsgBox("Random Message")
-
End If
-
Catch ex As Exception
-
ErrorTrap(ex,
-
System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
-
End Try
-
End Sub
-
-
First thing I would do is refactor all the if thens to guard clauses with
custom exceptions instead of exitSub's http://www.refactoring.com/catalog/r...rdClauses.html
--
--Eric Cathell, MCSA
"jburkle" <jb*****@gmail. com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . - .....
- Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Try
- If x Is Nothing Then
- Exit Sub
- End If
- If y > 0 Then
- If z = 0 Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- If a Then
- MessageBox.Show("Random Message")
- Exit Sub
- End If
- If (b Or c) Then
- MsgBox("Random Message")
- Exit Sub
- Else
- If d Then
- ...
- If e Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- If f Then
- ...
- If g Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- MsgBox("Random Message")
- Exit Sub
- End If
- End If
- End If
- ''Problem Here
- If (h = 123) Then
- MsgBox("This Message Displays to the User while Done!
- MessageBox is also being Displayed")
- Exit Sub
- End If
- If i <> "" Then
- ...
- If j Then
- MsgBox("Random Message")
- Exit Sub
- End If
- If k Then
- ...
- Else
- If l Then
- ...
- Else
- ...
- End If
- End If
- ''Gets to here
- Call DoStuff() ''inside this, "h" set to 123
- MessageBox.Show(me,"Done!", "", MessageBoxButtons.OK)
- Else
- MsgBox("Random Message")
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- End Try
- End Sub
-
Is there any place where I can get more information and VB examples
regarding guard clauses?
Thank you.
"ECathell" <ec******@nospa m.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. First thing I would do is refactor all the if thens to guard clauses with custom exceptions instead of exitSub's
http://www.refactoring.com/catalog/r...rdClauses.html
-- --Eric Cathell, MCSA "jburkle" <jb*****@gmail. com> wrote in message news:11******** **************@ g44g2000cwa.goo glegroups.com.. . - .....
- Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Try
- If x Is Nothing Then
- Exit Sub
- End If
- If y > 0 Then
- If z = 0 Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- If a Then
- MessageBox.Show("Random Message")
- Exit Sub
- End If
- If (b Or c) Then
- MsgBox("Random Message")
- Exit Sub
- Else
- If d Then
- ...
- If e Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- If f Then
- ...
- If g Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- MsgBox("Random Message")
- Exit Sub
- End If
- End If
- End If
- ''Problem Here
- If (h = 123) Then
- MsgBox("This Message Displays to the User while Done!
- MessageBox is also being Displayed")
- Exit Sub
- End If
- If i <> "" Then
- ...
- If j Then
- MsgBox("Random Message")
- Exit Sub
- End If
- If k Then
- ...
- Else
- If l Then
- ...
- Else
- ...
- End If
- End If
- ''Gets to here
- Call DoStuff() ''inside this, "h" set to 123
- MessageBox.Show(me,"Done!", "", MessageBoxButtons.OK)
- Else
- MsgBox("Random Message")
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- End Try
- End Sub
-
jburkle,
A couple of points:
1. This is ugly code. (But it still should not display 2 message boxes).
2. You are not showing us a subset of your code in which the problem can be
reproduced. For example, you don't show any code for the DoStuff subprocedure.
Can you create a subset of your code that has the problem and that can be
used by others to reproduce the problem? In other words, no ellipses,
subprocedures present, no missing code that might be using threads, etc.
Kerry Moorman
"jburkle" wrote: - .....
- Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Try
- If x Is Nothing Then
- Exit Sub
- End If
- If y > 0 Then
- If z = 0 Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- If a Then
- MessageBox.Show("Random Message")
- Exit Sub
- End If
- If (b Or c) Then
- MsgBox("Random Message")
- Exit Sub
- Else
- If d Then
- ...
- If e Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- If f Then
- ...
- If g Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- MsgBox("Random Message")
- Exit Sub
- End If
- End If
- End If
- ''Problem Here
- If (h = 123) Then
- MsgBox("This Message Displays to the User while Done!
- MessageBox is also being Displayed")
- Exit Sub
- End If
- If i <> "" Then
- ...
- If j Then
- MsgBox("Random Message")
- Exit Sub
- End If
- If k Then
- ...
- Else
- If l Then
- ...
- Else
- ...
- End If
- End If
- ''Gets to here
- Call DoStuff() ''inside this, "h" set to 123
- MessageBox.Show(me,"Done!", "", MessageBoxButtons.OK)
- Else
- MsgBox("Random Message")
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- End Try
- End Sub
-
First, you need to give more code here in order for anyone to be able to
reproduce this. Your screenshot shows two message boxes but only one of
them is called from the code you posted. Post everythign you have, and
folks may be able to help you. Include a full screenshot as well, showing
your task bar. I suspect that you have other windows open as part of this
app that may have somethign to do with your problem.
Second, why are you using both messagebox.show () and msgbox() in your code?
Third, this code looks like it does nothgin at all, what exactly are you
trying to test here?
Lastly, why are you posting twice in the same newsgroup for the same issue?
There are still folks replying to yuour first post and you havent responded
to some of their questions/suggestions.
"jburkle" <jb*****@gmail. com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . - .....
- Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Try
- If x Is Nothing Then
- Exit Sub
- End If
- If y > 0 Then
- If z = 0 Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- If a Then
- MessageBox.Show("Random Message")
- Exit Sub
- End If
- If (b Or c) Then
- MsgBox("Random Message")
- Exit Sub
- Else
- If d Then
- ...
- If e Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- If f Then
- ...
- If g Then
- MsgBox("Random Message")
- Exit Sub
- End If
- Else
- MsgBox("Random Message")
- Exit Sub
- End If
- End If
- End If
- ''Problem Here
- If (h = 123) Then
- MsgBox("This Message Displays to the User while Done!
- MessageBox is also being Displayed")
- Exit Sub
- End If
- If i <> "" Then
- ...
- If j Then
- MsgBox("Random Message")
- Exit Sub
- End If
- If k Then
- ...
- Else
- If l Then
- ...
- Else
- ...
- End If
- End If
- ''Gets to here
- Call DoStuff() ''inside this, "h" set to 123
- MessageBox.Show(me,"Done!", "", MessageBoxButtons.OK)
- Else
- MsgBox("Random Message")
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- End Try
- End Sub
-
-
Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
-
eventArgs As System.EventArgs) Handles cmdRenew.Click
-
Me.EnableFrameSepAddressButtons(False)
-
Dim strMessage As String
-
Try
-
Dim intIndexfield As Integer
-
Dim strMagId As String
-
Dim intIssyr As Integer
-
Dim iProdIssues As Integer
-
Dim dr_selectMagazine As DataRow
-
Dim dr_MagInfo As DataRow
-
Dim dr_loadCustomerInfo As DataRow
-
Dim dt_RenewalDate As Date
-
-
'Implemented 3/31/2003
-
'Check the Magazine subscription plan versus the payment
-
plan first!
-
If Me.gridMagazineList.DataSource Is Nothing Then
-
Exit Sub
-
End If
-
'Check the status of the account before continuing.
-
Accounts that are not PIF
-
'wont' be allowed to renew magazines
-
Dim bm As BindingManagerBase =
-
Me.gridMagazineList.BindingContext(Me.gridMagazineList.DataSource,
-
Me.gridMagazineList.DataMember)
-
If bm.Count > 0 Then
-
Dim drDataRow As DataRow = CType(bm.Current,
-
DataRowView).Row
-
intIndexfield = IfIsNullInt(drDataRow("IndexField"))
-
If intIndexfield = 0 Then
-
strMessage = "Invalid Magazine Selection"
-
Exit Sub
-
End If
-
Else
-
Exit Sub
-
End If
-
dr_selectMagazine =
-
sql_fCustomer.selectMagazine(intIndexfield).Rows(0)
-
If (dr_selectMagazine("inactive") = 1) Then
-
strMessage = "The magazine is inactive and cannot be
-
renewed."
-
Exit Sub
-
End If
-
If (dr_selectMagazine("OD_Status") = 40 Or
-
dr_selectMagazine("OD_Status") = 94) Or
-
IfIsNullDate((dr_selectMagazine("OD_Next_prod_date"))) = "" Or
-
(dr_selectMagazine("Od_numiss") - dr_selectMagazine("od_issuessent"))
-
<= 0 Then
-
strMessage = "This magazine has been Cancelled or there
-
are not more issues left to be Renewed!"
-
Exit Sub
-
Else
-
'this is the override that allows
-
'for Renewal, even if the date isn't close.
-
If UserInfo.haveAccess("RenewalData_Entry_Override")
-
Then
-
'we do want to prevent too fast of a renewal... 4
-
month is set by Vikki
-
If dtoday <
-
(CDate(dr_selectMagazine("CurrentProdDate")).AddMonths(4)) Then
-
strMessage = "You must wait until [" &
-
CDate(dr_selectMagazine("CurrentProdDate")).AddMonths(4).Date.ToString
-
& "] to do renewal for this magazine."
-
Exit Sub
-
End If
-
Else
-
dr_loadCustomerInfo =
-
sql_fCustomer.loadCustomerInfo(lngCustNumber, mnordernumber).Rows(0)
-
'adding "IfIsNullSng" to Order_Amount_Due
-
strMagId = IfIsNullString(Me.txtMagID.Text.Trim)
-
dr_MagInfo =
-
sql_fCustomer.MagInfo(strMagId).Rows(0)
-
'need to be able to renew single year half PIFs
-
' (dr_loadCustomerInfo("order_current_status") =
-
109)
-
-
If ((dr_loadCustomerInfo("order_current_status") =
-
109)) Or _
-
(dr_loadCustomerInfo("order_current_status") =
-
89) Or ((dr_loadCustomerInfo("Order_current_status") = 39) _
-
And
-
(IfIsNullSingle(dr_loadCustomerInfo("Order_Amount_Due")) <
-
IfIsNullSingle(dr_loadCustomerInfo("Order_current_monthly_Payment"))))
-
Then
-
dt_RenewalDate =
-
(CDate(dr_selectMagazine("OD_Prod_Date_1")).AddYears( _
-
(CSng(dr_selectMagazine("OD_Issuessent")) /
-
CSng(dr_selectMagazine("OD_Issues_Year"))))).AddMonths(-3)
-
If dtoday <= dt_RenewalDate Then
-
strMessage = "The current production for
-
this magazine hasn't expired yet, the next possible order date is after
-
[" & dt_RenewalDate & "]"
-
Exit Sub
-
End If
-
Else
-
strMessage = "This account needs to be PIF or
-
in good standing in order to renew Magazines!"
-
Exit Sub
-
End If
-
End If
-
End If
-
-
If (dr_selectMagazine("OD_Status") = 123) Then
-
strMessage = "The magazine is waiting production,
-
renewing at the moment. It cannot be renewed again until after next
-
production."
-
Exit Sub
-
End If
-
'Gets Information from tblMags on a specific magazine
-
strMagId = IfIsNullString(Me.txtMagID.Text.Trim)
-
If strMagId <> "" Then
-
dr_MagInfo = sql_fCustomer.MagInfo(strMagId).Rows(0)
-
intIssyr = dr_MagInfo("IssYr")
-
If dr_MagInfo("inactive") Then
-
strMessage = "This magazine is Inactive!"
-
Exit Sub
-
End If
-
'The total # of issues left will be ordered, unless the
-
magazine is only for 1 year or the the maximum
-
'# of issues that can be sent is less than the issues
-
left
-
If dr_MagInfo("MagSingYear") Then
-
iProdIssues = intIssyr
-
Else
-
'Magazines, unless the MaxISS is smaller
-
(fulfillment house won't let us order any more).
-
If dr_MagInfo("MaxIss") >
-
dr_selectMagazine("OD_NUMIss") - dr_selectMagazine("Od_Issuessent")
-
Then
-
iProdIssues = dr_selectMagazine("OD_NUMIss") -
-
dr_selectMagazine("Od_issuessent")
-
Else
-
iProdIssues = dr_MagInfo("MaxIss")
-
End If
-
End If
-
-
sql_fCustomer.ProductionRenewal_Queue(lngCustNumber,
-
mnordernumber, intIndexfield, iProdIssues, dtoday, intIssyr, strMagId,
-
False)
-
-
sql_fCustomer.InsertMagEdit_Queue((dr_selectMagazine("Custnum")),
-
(dr_selectMagazine("Ordernum")), intIndexfield, "Renewed Magazine by
-
using the renew button: " & dr_selectMagazine("OD_Mag_ID"),
-
(UserInfo.userID), True)
-
strMessage = "Done!"
-
LoadMagInfo()
-
Exit Sub
-
Else
-
strMessage = "MagID is blank"
-
Exit Sub
-
End If
-
Catch ex As Exception
-
ErrorTrap(ex,
-
System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
-
Finally
-
If Not strMessage Is Nothing Then
-
MessageBox.Show(Me, strMessage, "",
-
MessageBoxButtons.OK, MessageBoxIcon.Information)
-
End If
-
Me.EnableFrameSepAddressButtons(True)
-
End Try
-
End Sub
-
-
-
Public Sub LoadMagInfo()
-
-
Dim dtMagInfo As DataTable
-
Dim iIndex As Integer
-
Dim strOD_Status As String
-
Dim dtDataTable As DataTable
-
-
Try
-
gridMagazineList.Redraw = False
-
dtMagInfo = sql_fCustomer.LoadMagazineInfo(lngCustNumber,
-
mnordernumber)
-
If dtMagInfo.Rows.Count > 0 Then
-
dtMagInfo.TableName = "Magazine List"
-
strOD_Status = dtMagInfo.Rows(0)("OD_Status")
-
-
'if the status is "UQ" we don't allow magazine change
-
TDP-05/07/04 >>>
-
If (strOD_Status = "Under Query") Then
-
EnableButtons(False)
-
Else
-
EnableButtons(True)
-
End If
-
'TDP-05/07/04 <<<
-
-
For iIndex = 0 To dtMagInfo.Rows.Count - 1
-
strOD_Status = dtMagInfo.Rows(iIndex)("OD_Status")
-
If (strOD_Status.Trim = "PendingCancel") Then
-
dtMagInfo.Rows(iIndex)("OD_Status") =
-
"Cancelled"
-
End If
-
-
If (dtMagInfo.Rows(iIndex)("UMC_NotUnique")) Then
-
dtDataTable =
-
sql_fCustomer.getUniqueMagazineName(dtMagInfo.Rows(iIndex)("OD_Mag_ID"),
-
_
-
-
dtMagInfo.Rows(iIndex)("Ship_State"))
-
If dtDataTable.Rows.Count > 0 Then
-
dtMagInfo.Rows(iIndex)("MagName") =
-
dtDataTable.Rows(0)("MagName") & " (" &
-
dtMagInfo.Rows(iIndex)("MagName") & ")"
-
End If
-
-
End If
-
Next
-
-
dtMagInfo.DefaultView.AllowNew = False
-
gridMagazineList.DataSource = dtMagInfo
-
-
End If
-
-
Call SetupgridMagazineList()
-
-
gridMagazineList.Redraw = True
-
Call LoadComplaintInfo()
-
SetUpPermissions()
-
Catch ex As Exception
-
If ex.GetType Is GetType(System.IndexOutOfRangeException)
-
Or _
-
ex.GetType Is GetType(System.ArgumentException) Then
-
-
ErrorTrapNoMsgBox(ex,
-
System.Reflection.MethodInfo.GetCurrentMethod.Name, "Recreating Grid")
-
-
-
Me.tabCust_CustomerInformation.Controls.Remove(Me.gridMagazineList)
-
Dim gridMagazineList2 As New
-
LazarusControls.FlexDataGrid
-
CType(gridMagazineList2,
-
System.ComponentModel.ISupportInitialize).BeginInit()
-
-
gridMagazineList2.CaptionText = "Magazine List"
-
gridMagazineList2.DataMember = ""
-
gridMagazineList2.HeaderForeColor =
-
System.Drawing.SystemColors.ControlText
-
gridMagazineList2.Location = New
-
System.Drawing.Point(8, 8)
-
gridMagazineList2.Name = "gridMagazineList"
-
gridMagazineList2.Size = New System.Drawing.Size(640,
-
240)
-
gridMagazineList2.TabIndex = 194
-
-
CType(gridMagazineList2,
-
System.ComponentModel.ISupportInitialize).EndInit()
-
Me.gridMagazineList = gridMagazineList2
-
-
Me.tabCust_CustomerInformation.Controls.Add(Me.gridMagazineList)
-
-
Try
-
gridMagazineList.Redraw = False
-
dtMagInfo =
-
sql_fCustomer.LoadMagazineInfo(lngCustNumber, mnordernumber)
-
dtMagInfo.TableName = "Magazine List"
-
-
For iIndex = 0 To dtMagInfo.Rows.Count - 1
-
strOD_Status =
-
dtMagInfo.Rows(iIndex)("OD_Status")
-
If (strOD_Status.Trim = "PendingCancel") Then
-
dtMagInfo.Rows(iIndex)("OD_Status") =
-
"Cancelled"
-
End If
-
-
-
'Added on 7/21/2003 for those rogues at Game &
-
Fish cht
-
If (dtMagInfo.Rows(iIndex)("UMC_NotUnique"))
-
Then
-
dtDataTable =
-
sql_fCustomer.getUniqueMagazineName(dtMagInfo.Rows(iIndex)("OD_Mag_ID"),
-
_
-
-
dtMagInfo.Rows(iIndex)("Ship_State"))
-
If dtDataTable.Rows.Count > 0 Then
-
dtMagInfo.Rows(iIndex)("MagName") =
-
dtDataTable.Rows(0)("MagName") & " (" &
-
dtMagInfo.Rows(iIndex)("MagName") & ")"
-
End If
-
-
End If
-
Next
-
-
dtMagInfo.DefaultView.AllowNew = False
-
gridMagazineList.DataSource = dtMagInfo
-
-
Call SetupgridMagazineList()
-
-
gridMagazineList.Redraw = True
-
Call LoadComplaintInfo()
-
Catch ex2 As Exception
-
ErrorTrap(ex2,
-
System.Reflection.MethodInfo.GetCurrentMethod.Name, "Recreate Grid
-
Failed")
-
End Try
-
-
Else
-
ErrorTrap(ex,
-
System.Reflection.MethodInfo.GetCurrentMethod.Name, "" _
-
)
-
End If
-
End Try
-
End Sub
-
Here is the onclick event that is causing the problem, I thought that
moving the MessageBox Call into the Finally block would fix the
problem, however it hasn't.
I guess the question woudl be which specific lines of code are generating
the two different message boxes you are referring to?
Also, how many seperate windows (forms) do you have open when this occurs,
and which forms are generating each of the message boxes?
"jburkle" <jb*****@gmail. com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . - Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal
- eventArgs As System.EventArgs) Handles cmdRenew.Click
- Me.EnableFrameSepAddressButtons(False)
- Dim strMessage As String
- Try
- Dim intIndexfield As Integer
- Dim strMagId As String
- Dim intIssyr As Integer
- Dim iProdIssues As Integer
- Dim dr_selectMagazine As DataRow
- Dim dr_MagInfo As DataRow
- Dim dr_loadCustomerInfo As DataRow
- Dim dt_RenewalDate As Date
- 'Implemented 3/31/2003
- 'Check the Magazine subscription plan versus the payment
- plan first!
- If Me.gridMagazineList.DataSource Is Nothing Then
- Exit Sub
- End If
- 'Check the status of the account before continuing.
- Accounts that are not PIF
- 'wont' be allowed to renew magazines
- Dim bm As BindingManagerBase =
- Me.gridMagazineList.BindingContext(Me.gridMagazineList.DataSource,
- Me.gridMagazineList.DataMember)
- If bm.Count > 0 Then
- Dim drDataRow As DataRow = CType(bm.Current,
- DataRowView).Row
- intIndexfield = IfIsNullInt(drDataRow("IndexField"))
- If intIndexfield = 0 Then
- strMessage = "Invalid Magazine Selection"
- Exit Sub
- End If
- Else
- Exit Sub
- End If
- dr_selectMagazine =
- sql_fCustomer.selectMagazine(intIndexfield).Rows(0)
- If (dr_selectMagazine("inactive") = 1) Then
- strMessage = "The magazine is inactive and cannot be
- renewed."
- Exit Sub
- End If
- If (dr_selectMagazine("OD_Status") = 40 Or
- dr_selectMagazine("OD_Status") = 94) Or
- IfIsNullDate((dr_selectMagazine("OD_Next_prod_date"))) = "" Or
- (dr_selectMagazine("Od_numiss") - dr_selectMagazine("od_issuessent"))
- <= 0 Then
- strMessage = "This magazine has been Cancelled or there
- are not more issues left to be Renewed!"
- Exit Sub
- Else
- 'this is the override that allows
- 'for Renewal, even if the date isn't close.
- If UserInfo.haveAccess("RenewalData_Entry_Override")
- Then
- 'we do want to prevent too fast of a renewal... 4
- month is set by Vikki
- If dtoday <
- (CDate(dr_selectMagazine("CurrentProdDate")).AddMonths(4)) Then
- strMessage = "You must wait until [" &
- CDate(dr_selectMagazine("CurrentProdDate")).AddMonths(4).Date.ToString
- & "] to do renewal for this magazine."
- Exit Sub
- End If
- Else
- dr_loadCustomerInfo =
- sql_fCustomer.loadCustomerInfo(lngCustNumber, mnordernumber).Rows(0)
- 'adding "IfIsNullSng" to Order_Amount_Due
- strMagId = IfIsNullString(Me.txtMagID.Text.Trim)
- dr_MagInfo =
- sql_fCustomer.MagInfo(strMagId).Rows(0)
- 'need to be able to renew single year half PIFs
- ' (dr_loadCustomerInfo("order_current_status") =
- 109)
- If ((dr_loadCustomerInfo("order_current_status") =
- 109)) Or _
- (dr_loadCustomerInfo("order_current_status") =
- 89) Or ((dr_loadCustomerInfo("Order_current_status") = 39) _
- And
- (IfIsNullSingle(dr_loadCustomerInfo("Order_Amount_Due")) <
- IfIsNullSingle(dr_loadCustomerInfo("Order_current_monthly_Payment"))))
- Then
- dt_RenewalDate =
- (CDate(dr_selectMagazine("OD_Prod_Date_1")).AddYears( _
- (CSng(dr_selectMagazine("OD_Issuessent")) /
- CSng(dr_selectMagazine("OD_Issues_Year"))))).AddMonths(-3)
- If dtoday <= dt_RenewalDate Then
- strMessage = "The current production for
- this magazine hasn't expired yet, the next possible order date is after
- [" & dt_RenewalDate & "]"
- Exit Sub
- End If
- Else
- strMessage = "This account needs to be PIF or
- in good standing in order to renew Magazines!"
- Exit Sub
- End If
- End If
- End If
- If (dr_selectMagazine("OD_Status") = 123) Then
- strMessage = "The magazine is waiting production,
- renewing at the moment. It cannot be renewed again until after next
- production."
- Exit Sub
- End If
- 'Gets Information from tblMags on a specific magazine
- strMagId = IfIsNullString(Me.txtMagID.Text.Trim)
- If strMagId <> "" Then
- dr_MagInfo = sql_fCustomer.MagInfo(strMagId).Rows(0)
- intIssyr = dr_MagInfo("IssYr")
- If dr_MagInfo("inactive") Then
- strMessage = "This magazine is Inactive!"
- Exit Sub
- End If
- 'The total # of issues left will be ordered, unless the
- magazine is only for 1 year or the the maximum
- '# of issues that can be sent is less than the issues
- left
- If dr_MagInfo("MagSingYear") Then
- iProdIssues = intIssyr
- Else
- 'Magazines, unless the MaxISS is smaller
- (fulfillment house won't let us order any more).
- If dr_MagInfo("MaxIss") >
- dr_selectMagazine("OD_NUMIss") - dr_selectMagazine("Od_Issuessent")
- Then
- iProdIssues = dr_selectMagazine("OD_NUMIss") -
- dr_selectMagazine("Od_issuessent")
- Else
- iProdIssues = dr_MagInfo("MaxIss")
- End If
- End If
- sql_fCustomer.ProductionRenewal_Queue(lngCustNumber,
- mnordernumber, intIndexfield, iProdIssues, dtoday, intIssyr, strMagId,
- False)
- sql_fCustomer.InsertMagEdit_Queue((dr_selectMagazine("Custnum")),
- (dr_selectMagazine("Ordernum")), intIndexfield, "Renewed Magazine by
- using the renew button: " & dr_selectMagazine("OD_Mag_ID"),
- (UserInfo.userID), True)
- strMessage = "Done!"
- LoadMagInfo()
- Exit Sub
- Else
- strMessage = "MagID is blank"
- Exit Sub
- End If
- Catch ex As Exception
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "")
- Finally
- If Not strMessage Is Nothing Then
- MessageBox.Show(Me, strMessage, "",
- MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- Me.EnableFrameSepAddressButtons(True)
- End Try
- End Sub
-
- Public Sub LoadMagInfo()
- Dim dtMagInfo As DataTable
- Dim iIndex As Integer
- Dim strOD_Status As String
- Dim dtDataTable As DataTable
- Try
- gridMagazineList.Redraw = False
- dtMagInfo = sql_fCustomer.LoadMagazineInfo(lngCustNumber,
- mnordernumber)
- If dtMagInfo.Rows.Count > 0 Then
- dtMagInfo.TableName = "Magazine List"
- strOD_Status = dtMagInfo.Rows(0)("OD_Status")
- 'if the status is "UQ" we don't allow magazine change
- TDP-05/07/04 >>>
- If (strOD_Status = "Under Query") Then
- EnableButtons(False)
- Else
- EnableButtons(True)
- End If
- 'TDP-05/07/04 <<<
- For iIndex = 0 To dtMagInfo.Rows.Count - 1
- strOD_Status = dtMagInfo.Rows(iIndex)("OD_Status")
- If (strOD_Status.Trim = "PendingCancel") Then
- dtMagInfo.Rows(iIndex)("OD_Status") =
- "Cancelled"
- End If
- If (dtMagInfo.Rows(iIndex)("UMC_NotUnique")) Then
- dtDataTable =
- sql_fCustomer.getUniqueMagazineName(dtMagInfo.Rows(iIndex)("OD_Mag_ID"),
- _
- dtMagInfo.Rows(iIndex)("Ship_State"))
- If dtDataTable.Rows.Count > 0 Then
- dtMagInfo.Rows(iIndex)("MagName") =
- dtDataTable.Rows(0)("MagName") & " (" &
- dtMagInfo.Rows(iIndex)("MagName") & ")"
- End If
- End If
- Next
- dtMagInfo.DefaultView.AllowNew = False
- gridMagazineList.DataSource = dtMagInfo
- End If
- Call SetupgridMagazineList()
- gridMagazineList.Redraw = True
- Call LoadComplaintInfo()
- SetUpPermissions()
- Catch ex As Exception
- If ex.GetType Is GetType(System.IndexOutOfRangeException)
- Or _
- ex.GetType Is GetType(System.ArgumentException) Then
- ErrorTrapNoMsgBox(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "Recreating Grid")
- Me.tabCust_CustomerInformation.Controls.Remove(Me.gridMagazineList)
- Dim gridMagazineList2 As New
- LazarusControls.FlexDataGrid
- CType(gridMagazineList2,
- System.ComponentModel.ISupportInitialize).BeginInit()
- gridMagazineList2.CaptionText = "Magazine List"
- gridMagazineList2.DataMember = ""
- gridMagazineList2.HeaderForeColor =
- System.Drawing.SystemColors.ControlText
- gridMagazineList2.Location = New
- System.Drawing.Point(8, 8)
- gridMagazineList2.Name = "gridMagazineList"
- gridMagazineList2.Size = New System.Drawing.Size(640,
- 240)
- gridMagazineList2.TabIndex = 194
- CType(gridMagazineList2,
- System.ComponentModel.ISupportInitialize).EndInit()
- Me.gridMagazineList = gridMagazineList2
- Me.tabCust_CustomerInformation.Controls.Add(Me.gridMagazineList)
- Try
- gridMagazineList.Redraw = False
- dtMagInfo =
- sql_fCustomer.LoadMagazineInfo(lngCustNumber, mnordernumber)
- dtMagInfo.TableName = "Magazine List"
- For iIndex = 0 To dtMagInfo.Rows.Count - 1
- strOD_Status =
- dtMagInfo.Rows(iIndex)("OD_Status")
- If (strOD_Status.Trim = "PendingCancel") Then
- dtMagInfo.Rows(iIndex)("OD_Status") =
- "Cancelled"
- End If
- 'Added on 7/21/2003 for those rogues at Game &
- Fish cht
- If (dtMagInfo.Rows(iIndex)("UMC_NotUnique"))
- Then
- dtDataTable =
- sql_fCustomer.getUniqueMagazineName(dtMagInfo.Rows(iIndex)("OD_Mag_ID"),
- _
- dtMagInfo.Rows(iIndex)("Ship_State"))
- If dtDataTable.Rows.Count > 0 Then
- dtMagInfo.Rows(iIndex)("MagName") =
- dtDataTable.Rows(0)("MagName") & " (" &
- dtMagInfo.Rows(iIndex)("MagName") & ")"
- End If
- End If
- Next
- dtMagInfo.DefaultView.AllowNew = False
- gridMagazineList.DataSource = dtMagInfo
- Call SetupgridMagazineList()
- gridMagazineList.Redraw = True
- Call LoadComplaintInfo()
- Catch ex2 As Exception
- ErrorTrap(ex2,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "Recreate Grid
- Failed")
- End Try
- Else
- ErrorTrap(ex,
- System.Reflection.MethodInfo.GetCurrentMethod.Name, "" _
- )
- End If
- End Try
- End Sub
-
Here is the onclick event that is causing the problem, I thought that moving the MessageBox Call into the Finally block would fix the problem, however it hasn't.
I am sorry if I am confusing anyone with this issue, the thing is that
I can't replicate the issue on our testing system, but it happens to
the end user and does so for different users on different computers.
the code is being called from a button that is on a
System.Windows. Forms.GroupBox which is in a
System.Windows. Forms.TabContro l which is in the fCustomer.vb form.
this fCustomer.vb form is in the main mdi.vb form for the program.
The 2 message boxs displayed are the "Done!" box when it does the
updating in the end, and also the "The magazine is waiting production,
renewing at the moment. It cannot be renewed again until after next
production." message box at the OD_status = 123 check........ when the
"Done!" is reached the code before it sets OD_status = 123..... but i
looked for where it could be called again inside the onclick and
couldnt find it, also i added the EnableButtons(f alse) call to disable
all buttons to try and ensure that the user cant double click them. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
I have several pairs of synchronized subforms in an application. I have a Delete
button for each pair that uses the following code or similar to delete a record
in the second subform:
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If
ExitHere:
Me!SubName.SetFocus
|
by: Steve Grahovac |
last post by:
I have been having trouble the last few days opening any ASP.NET web
forms in the design view in the designer. Every time I clicked on an
aspx file I got a message box with the error "Unable to open in
designer. Illegal characters in path" and the file is instead opened
in HTML view. I don't know what application or situation may have
caused this error. I looked on the newsgroups and noticed that
numerous other people were having this...
|
by: Cris Rock |
last post by:
In my ASP.Net application, validation rule demands that user has to select
one of the option buton(...WebControls.RadioButton).
I am doing these kind of validations in the server side when the user clicks
on the update button(...webControls.Button). My problem is how to display
this message to the end user. In a traditional desktop apllication i can
display the message usig message functions or modal forms. How to inform the
user that the...
|
by: Mark |
last post by:
Hello all -
I'm not sure if this is an ASP.Net issue or a Crystal Reports issue but I built a web reporting website that runs under SSL. The way the reports are displayed to the user has it where the report data is exported into PDF format on the local webserver and then flush to the browser for the user to view. I have a batch utility that runs on a scheduler to clean up the files daily. The problem I'm experiencing though is on some...
|
by: JTrigger |
last post by:
When I compile my project using the IDE on a development machine it works
just fine. When I compile it on the server using csc.exe, I get the
following error when I try to bring it up in the web browser. What is the
issue?
Thanks,
Jim
Server Error in '/psnRequest' Application.
----------------------------------------------------------------------------
| |
by: Jens Øster |
last post by:
Hi
I am writing a ASP.NET web application that must sent some e-mails.
I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect.
I think it is a relay issue. Our system administrator will not allow relaying.
In the ASP.Net web.config file I let the web application...
|
by: Richard Finnigan |
last post by:
Hi
I was wondering if anyone could help me with this problem. I've been using
VWD and my webhost ( a shared hosting package) have told me that the MSQL
express files wont work on thier server so I've tried switching to Access
and I cant add or delete new records either locally or on thier server.
I keep getting this error message.
"You tried to assign the Null value to a variable that is not a Variant data
|
by: Alex A. |
last post by:
I have this web application that runs for about 5 minutes doing to
database processing, about 50% of the time I get the error message
Thread was being aborted.
I am looking for hint at where to look, I've been banging my head on
this issue for a couple of months (when I have time to bang my head on
this).
Here's some information on my app:
|
by: Ivan Weiss |
last post by:
Good morning all,
I am trying to access an access database to authenticate users upon
logging into my application.
Something is throwing an excecption. My error handling code should
display this message in a msgbox. However, the messagebox is always
empty.
Here is my error handling code.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |