Combobox .change event stops work after a while??

K

Karsten_Markmann

Hi
I am building a large application where we use the combobox feature a
lot.
Its an office addin for office XP.
I am using Visual studio 2003 VB.

In outlook and excel it works perfect all the time, but in Word it
stops work after a randomly amount of time?
(The Event ".Change" does apparently not fire).
Does anyone have some ideas what can cause this problem?

Below are some code snippets from my application.
Any help appriciated.

Kind Regards:
Karsten Markmann

<GuidAttribute("9132AA66-FDA6-4023-BCEB-75BA61D2997C"),
ProgIdAttribute("KiCSystem.Connect")> _
Public Class Connect

Implements Extensibility.IDTExtensibility2
Private WithEvents cmbSearchCoveo As CommandBarComboBox
----

cbrNewToolbar = KiCData.hostApp.CommandBars.Add(Name:="KiC LRØ
system 2", Position:=msoBarTop, Temporary:=True)
----

cmbSearchCoveo =
cbrNewToolbar.Controls.Add(Type:=MsoControlType.msoControlComboBox)
With cmbSearchCoveo
.BeginGroup = True
.Visible = True
.Style = MsoComboStyle.msoComboLabel
.Caption = "Fritekst søgning:"
.TooltipText = "Fritekst søgefelt i KiC systemet.
Søger i alle dokumenter efter det skrevne."
.Tag = "SearchCoveo"
End With

----

Private Sub cmbSearchCoveo_Change(ByVal Ctrl As
Microsoft.Office.Core.CommandBarComboBox) Handles
cmbSearchCoveo.Change

ShowIEURL(HTTPSEARCH & cmbSearchCoveo.Text)

End Sub
---
 
C

Cindy M.

Hi Karsten_Markmann,
I am building a large application where we use the combobox feature a
lot.
Its an office addin for office XP.
I am using Visual studio 2003 VB.

In outlook and excel it works perfect all the time, but in Word it
stops work after a randomly amount of time?
(The Event ".Change" does apparently not fire).
Does anyone have some ideas what can cause this problem?
Difficult to tell, but it looks like you didn't declare the object
variable for the toolbars and buttons at the class level? If you do
not, they'll eventually be garbage collected.

The other thing to watch out for is that you should assign a unique
string value to the controls' TAG property. Word uses this (with its
MDI UI) to keep track of what window you're currently in.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
K

Karsten_Markmann

I have tried this now, but still having trouble?
The following is the start of my conect class:
Isn't this what you mean?
I alse have different tags for the buttons.


Option Explicit On

Imports Microsoft.Office.Core

Imports Extensibility
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.Windows.Forms
Imports System.IO

<GuidAttribute("9132AA66-FDA6-4023-BCEB-75BA61D2997C"),
ProgIdAttribute("KiCSystem.Connect")> _
Public Class Connect

Implements Extensibility.IDTExtensibility2
Private WithEvents cmbSearchCoveo As CommandBarComboBox
Public WithEvents cmdFindKiC As
Microsoft.Office.Core.CommandBarButton
Private WithEvents cmbFindKiC As
Microsoft.Office.Core.CommandBarButton
Private WithEvents cmbSaveEmailKiC As
Microsoft.Office.Core.CommandBarButton
Private WithEvents cmbSkabelonerKiC As
Microsoft.Office.Core.CommandBarButton
Private WithEvents cmbSearchCoveoButton As
Microsoft.Office.Core.CommandBarButton
Private cbrNewToolbarPrivate As CommandBar

-----
 
C

Cor Ligthert [MVP]

Karsten,

I an not (yet) known with using Microsoft.office in VB.Net.

However be aware that an event in a combobox in VB.Net will often result
that he calls himself again (recursive) a good reason that your program
stops because the combobox has eaten all your memory.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top