Hey there,
I am totally disappointed after I tried several days to get off this
problem. This happens sometimes in following case:
I am using [VS 2010 - 10.0.40219.1 SP1Rel + some Hotfixes on a WIN7 System]
I have a combobox which will be filled and filtered by Usernames which are
read from a datatable -> dataview. The datatable is filled before I work in
the combobox (see fill_UserTable()).
In the beginning the combobox is empty. After I entered the first character
the dataview is filtered so the dropdownlist only shows names beginning
with this character. And the next character - new filter so the amount of
the listitems get less. It also works into the other direction (growing
amount of listitems). Here is the code which handles combobox textchanged:
Dim dt_GlobalUser As New DataTable("dt_GlobalUser")
Dim filteredGlobalUserView As DataView = New DataView(dt_GlobalUser)
Dim m_userText As String = ""
Private Sub fill_UserTable()
'fill dt_GlobalUser, if empty
Dim counter As Integer = dt_GlobalUser.Rows.Count
If (counter = 0) Then
'ToDo: only Names from a specific department
Dim fbs As String = RegUserFBSplit()
'filling and counting with this routine
counter = get_RowCount(dt_GlobalUser, fbs)
End If
End Sub
Private Sub cob_GlobalUser_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles cob_UserName1.TextChanged,
cob_UserName2.TextChanged
If (sender.Equals(CType(cob_UserName1, ComboBox))) Then Call
check_COB_TextChanged(cob_UserName1)
If (sender.Equals(CType(cob_UserName2, ComboBox))) Then Call
check_COB_TextChanged(cob_UserName2)
End Sub
Private Sub check_COB_TextChanged(ByRef selectedCOB As ComboBox)
Try
Dim i As Integer = 0
Dim uName As String = ""
If (m_userText <> "") Then
If (selectedCOB.Text = "System.Data.DataRowView") Then
selectedCOB.Text = m_userText
End If
End If
uName = selectedCOB.Text
'in case it's not filled
Call fill_UserTable()
If (uName.Length > 0) Then
filteredGlobalUserView.RowFilter = "User_Name like '" &
uName & "%'"
filteredGlobalUserView.Sort = "User_Name ASC"
m_userText = uName
'after setting of datasource it calls again this routine
with selected text System.Data.DataRowView
selectedCOB.DataSource = filteredGlobalUserView
selectedCOB.DisplayMember = "User_Name"
selectedCOB.ValueMember = "USER_ALIAS"
'two comboboxes different behavior
Select Case TabPage.Name
Case "tp_1"
selectedCOB.Text = uName
selectedCOB.SelectionStart = selectedCOB.Text.Length
Case "tp_2"
If (selectedCOB.Items.Count > 0) Then
selectedCOB.Text = uName
selectedCOB.SelectionStart =
selectedCOB.Text.Length
End If
End Select
Else
filteredGlobalUserView.RowFilter = "User_Name = ''"
filteredGlobalUserView.Sort = "User_Name ASC"
m_userText = ""
selectedCOB.DataSource = filteredGlobalUserView
selectedCOB.DisplayMember = "User_Name"
selectedCOB.ValueMember = "USER_ALIAS"
selectedCOB.Text = ""
End If
Catch ex As AccessViolationException
My.Application.CRETURN.debug_print("cob_GlobalUser_TextChanged_AV_Ex",
ex.Message)
Catch ex As System.IndexOutOfRangeException
My.Application.CRETURN.debug_print("cob_GlobalUser_TextChanged_IOR_Ex",
ex.Message)
Catch ex As Exception
My.Application.CRETURN.debug_print("cob_GlobalUser_TextChanged_Ex",
ex.Message)
End Try
End Sub
I can not catch this error in the routine, it happens elsewhere.
Errormessage from the stack.trace is here:
System.AccessViolationException was not handled.
Message=Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
Source=System.Windows.Forms
StackTrace:
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
bei
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
bei
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
bei
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine)
bei FEAS.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
args)
bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
bei System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
bei System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
bei
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext, String[] activationCustomData)
bei
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext)
bei System.Activator.CreateInstance(ActivationContext
activationContext)
bei
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Does anybody know why this happens?
Joerg
--
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net
---
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.