Advertisement

09.24.2008 at 07:50AM PDT, ID: 23758865
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Messagebox error message

Asked by prasadpbr in .NET, Oracle Database, Visual Basic Programming

Tags: ,

Hi i just worte code to display pop up message to display when user trying add or remove in a table.
Its working fine on my system but when moved it to development server its showing error like
"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application." Could any know answer for this error?? You can see my vb.net code.

Thanks
BabuStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Text
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Xml
 
Partial Public Class Default2
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
 
    End Sub
 
    'remove user from Admin table
 
    Protected Sub AdminRemoveUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AdminRemoveUser.Click
        lbladminuser.Text = ""
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        For Each row As GridViewRow In Admingrid.Rows
            ' Access the CheckBox 
            Dim cb As CheckBox = DirectCast(row.FindControl("CBAdmin"), CheckBox)
            If cb IsNot Nothing AndAlso cb.Checked Then
 
                'code for pop up message when admin tries to remove user from the Admin role. 
                ' Define message. That will show as pop up message.
                msg = "This will remove the selected user from the EMR Admin role"
                style = MsgBoxStyle.DefaultButton3 Or _
                   MsgBoxStyle.OkCancel Or MsgBoxStyle.OkCancel
 
                ' Define title.
                title = "AdminUser Remove Alert"
 
                ' code to disaly pop up message 
                response = MsgBox(msg, style, title)
 
                ' User choose ok.
                If response = MsgBoxResult.Ok Then
                    Dim strName As String = row.Cells(1).Text
                    Dim reader As New XmlTextReader(Server.MapPath("~/App_Data/admin_users.xml"))
                    reader.WhitespaceHandling = WhitespaceHandling.None
                    Dim doc As New XmlDocument()
                    doc.Load(reader)
                    reader.Close()
                    Dim node As XmlNode = doc.SelectSingleNode("/adminUsers/AdminUser[@UserID = '" + strName + "']")
                    doc.DocumentElement.RemoveChild(node)
                    Dim writer As New XmlTextWriter(Server.MapPath("~/App_Data/admin_users.xml"), Encoding.UTF8)
                    doc.Save(writer)
                    writer.Close()
                    lbladminuser.Text = "User Removed successfully"
                Else
                    'User choose cancel
                    HttpContext.Current.Response.Redirect("adduser.aspx")
                End If
            End If
        Next
        HttpContext.Current.Response.Redirect("adduser.aspx")
    End Sub
 
    'remove the user from cdd table
 
    Protected Sub CDDRemoveUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CDDRemoveUser.Click
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        For Each row As GridViewRow In Cddgrid.Rows
            ' Access the CheckBox 
            Dim cb As CheckBox = DirectCast(row.FindControl("CBCDD"), CheckBox)
            If cb IsNot Nothing AndAlso cb.Checked Then
                'code for pop up message when admin tries to remove user from the Cdd role.
 
                msg = "This will remove the selected user from the EMR Cdd role"   ' Define message.
                style = MsgBoxStyle.DefaultButton1 Or _
                   MsgBoxStyle.OkCancel Or MsgBoxStyle.OkCancel
                title = "CddUser Remove Alert"   ' Define title.
                ' Display message.
                response = MsgBox(msg, style, title)
                If response = MsgBoxResult.Ok Then   ' User chose ok.
                    Dim strName As String = row.Cells(1).Text
                    Dim reader As New XmlTextReader(Server.MapPath("~/App_Data/cdd_users.xml"))
                    reader.WhitespaceHandling = WhitespaceHandling.None
                    Dim doc As New XmlDocument()
                    doc.Load(reader)
                    reader.Close()
                    Dim node As XmlNode = doc.SelectSingleNode("/cddusers/cddUser[@UserID = '" + strName + "']")
                    doc.DocumentElement.RemoveChild(node)
                    Dim writer As New XmlTextWriter(Server.MapPath("~/App_Data/cdd_users.xml"), Encoding.UTF8)
                    doc.Save(writer)
                    writer.Close()
                Else
                    HttpContext.Current.Response.Redirect("adduser.aspx")
                End If
            End If
        Next
        HttpContext.Current.Response.Redirect("adduser.aspx")
    End Sub
    'add user to the admin table
 
    Protected Sub AdminAddUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AdminAddUser.Click
        lbladminuser.Text = ""
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        Dim strUserID As String = TxtbxadminUserID1.Text
        Dim strUserFullname As String = Txtbxadminfullname.Text
        Dim reader As New XmlTextReader(Server.MapPath("~/App_Data/admin_users.xml"))
        reader.WhitespaceHandling = WhitespaceHandling.None
        Dim doc As New XmlDocument()
        doc.Load(reader)
        reader.Close()
        'make sure UserID and FullName fields should not be empty.
        If TxtbxadminUserID1.Text = "" Or Txtbxadminfullname.Text = "" Then
            lbladminuser.Text = "UserID and FullName fields Shouldn't be empty"
        Else
            ' Make sure that the user your trying to add is already in that table or not......
            Dim node1 As XmlNode = doc.SelectSingleNode("/adminUsers/AdminUser[@UserID = '" + strUserID + "']")
            If (node1 IsNot Nothing) Then
                lbladminuser.Text = "UserID is already exists"
            Else
                'code for pop up message when admin adding user to the admin role
                msg = "This will add the selected user for the EMR Admin role"   ' Define message.
                style = MsgBoxStyle.DefaultButton1 Or _
                   MsgBoxStyle.OkCancel Or MsgBoxStyle.OkCancel
                title = "Adminuser Add Alert"   ' Define title.
                ' Display message.
                response = MsgBox(msg, style, title)
                If response = MsgBoxResult.Ok Then   ' User chose ok
                    Dim node As XmlNode = doc.CreateNode(XmlNodeType.Element, "AdminUser", Nothing)
                    Dim attribute1 As XmlAttribute = doc.CreateAttribute("UserID")
                    attribute1.Value = strUserID
                    Dim attribute2 As XmlAttribute = doc.CreateAttribute("FullName")
                    attribute2.Value = strUserFullname
                    node.Attributes.Append(attribute1)
                    node.Attributes.Append(attribute2)
                    doc.DocumentElement.AppendChild(node)
                    Dim writer As New XmlTextWriter(Server.MapPath("~/App_Data/admin_users.xml"), Encoding.UTF8)
                    doc.Save(writer)
                    writer.Close()
                Else
                    HttpContext.Current.Response.Redirect("adduser.aspx")
                End If
                HttpContext.Current.Response.Redirect("adduser.aspx")
            End If
        End If
    End Sub
    'adding user to the cdd tables
 
    Protected Sub CDDAddUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CDDAddUser.Click
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        lblcdduser.Text = ""
        Dim strUserID As String = TxtbxcddUserID.Text
        Dim strUserFullname As String = Txtbxcddfullname.Text
        Dim reader As New XmlTextReader(Server.MapPath("~/App_Data/cdd_users.xml"))
        reader.WhitespaceHandling = WhitespaceHandling.None
        Dim doc As New XmlDocument()
        doc.Load(reader)
        reader.Close()
        If TxtbxcddUserID.Text = "" Or Txtbxcddfullname.Text = "" Then
            lblcdduser.Text = "UserID and FullName fields Shouldn't be empty"
        Else
            Dim node2 As XmlNode = doc.SelectSingleNode("/cddusers/cddUser[@UserID = '" + strUserID + "']")
            If (node2 IsNot Nothing) Then
                lblcdduser.Text = "UserID is already exists"
            Else
                'code for pop up message when admin adding user to the cdd role
                msg = "This will add the selected user for the EMR CDD role"   ' Define message.
                style = MsgBoxStyle.DefaultButton1 Or _
                   MsgBoxStyle.OkCancel Or MsgBoxStyle.OkCancel
                title = "CddUser Add Alert"   ' Define title.
                ' Display message.
                response = MsgBox(msg, style, title)
                If response = MsgBoxResult.Ok Then   ' User chose ok
                    Dim node As XmlNode = doc.CreateNode(XmlNodeType.Element, "cddUser", Nothing)
                    Dim attribute1 As XmlAttribute = doc.CreateAttribute("UserID")
                    attribute1.Value = strUserID
                    Dim attribute2 As XmlAttribute = doc.CreateAttribute("FullName")
                    attribute2.Value = strUserFullname
                    node.Attributes.Append(attribute1)
                    node.Attributes.Append(attribute2)
                    doc.DocumentElement.AppendChild(node)
                    Dim writer As New XmlTextWriter(Server.MapPath("~/App_Data/cdd_users.xml"), Encoding.UTF8)
                    doc.Save(writer)
                    writer.Close()
                    HttpContext.Current.Response.Redirect("adduser.aspx")
                End If
                HttpContext.Current.Response.Redirect("adduser.aspx")
            End If
        End If
    End Sub
 
    Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtbxadminUserID1.TextChanged
 
    End Sub
 
    Protected Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtbxcddUserID.TextChanged
 
    End Sub
 
    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Admingrid.SelectedIndexChanged
 
    End Sub
 
    Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Txtbxadminfullname.TextChanged
 
    End Sub
 
    Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Txtbxcddfullname.TextChanged
 
    End Sub
End Class
[+][-]09.24.2008 at 07:59AM PDT, ID: 22560388

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2008 at 08:04AM PDT, ID: 22560450

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2008 at 09:33AM PDT, ID: 22561444

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Oracle Database, Visual Basic Programming
Tags: Microsoft, Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notifi
Sign Up Now!
Solution Provided By: prasadpbr
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628