473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Comboxbox's SelectedIndexChanged event not functioning

I have a popup window, which consist of 2 combobox. The second
combobox's(cboCube) item collection will change based on the first
combobox's(cboDatabase) event(selectedindex_changed) is fired. And, I do have
write such code in code-behind as follow:

Private Sub cboDatabase_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboDatabase.SelectedIndexChanged
Dim strAdomdConnectionString As String

Try
With mdtsAnalysisDB.Tables(0).Rows(cboDatabase.Selected Index)
strAdomdConnectionString =
BuildAdomdConnectionString(CStr(.Item("ServerName" )),
CStr(.Item("AnalysisDBName")), CStr(.Item("UserName")),
CStr(.Item("Password")))
End With

FillCubeCombox(strAdomdConnectionString)

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub

Private Sub FillCubeCombox(ByVal pstrAdomdConnectionString As String)
Dim adomdConn As AdomdConnection
Dim cube As CubeDef

Try
adomdConn = New AdomdConnection(pstrAdomdConnectionString)
adomdConn.Open()

cboCube.Items.Clear()

For Each cube In adomdConn.Cubes
cboCube.Items.Add(cube.Caption)
Next

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub

But, why my second combobox's(cboCube) item collection won't change, when my
first combobox's(cboDatabase) selectedindex is changed? Besides, I also set
the first combobox's property(AutoPostBack) to true.

Please help... Thanks.

FYI, the following is my Page_Load code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strAdomdConnectionString As String

Try
If Not Me.IsPostBack Then
Me.btnOK.Attributes.Add("onclick", "Done('" &
txtConnectionString.Text & "');")

FillDatabaseCombobox()

With mdtsAnalysisDB.Tables(0).Rows(cboDatabase.Selected Index)
strAdomdConnectionString =
BuildAdomdConnectionString(CStr(.Item("ServerName" )),
CStr(.Item("AnalysisDBName")), CStr(.Item("UserName")),
CStr(.Item("Password")))
End With

FillCubeCombox(strAdomdConnectionString)
End If

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub

Nov 19 '05 #1
0 971

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sandman | last post by:
I've got a combo box that has an event handler set for SelectedIndexChanged event. The problem is that it's firing at startup when I load data from the Form_OnLoad event. I tried setting a flag...
0
by: PeacError | last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1: I apologize if this question has been addressed elsewhere, but I could not find a reference to it in the search engine for this...
0
by: tafpin | last post by:
I have an application with a datagrid. In the IDE I have 2 template columns. The first has an image button and the second contains a link button. According to the results that I get back I must...
3
by: Alec MacLean | last post by:
Hi, I have a couple of win forms where I am editing values that are stored in a SQL database. I'm using the listbox control to hold the data object each form interacts with. Each object is...
2
by: jnoody | last post by:
The problem I am having is with the SelectedIndexChanged event not always firing or the SelectedIndex property not being correct when the event does fire. The code is below, but here are some...
11
by: J055 | last post by:
Hi I have a dropdown control which is constructed in another dropdown control SelectedIndexChanged event protected void ddlParamType_SelectedIndexChanged(object sender, EventArgs e) { //...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
4
by: lakepeir | last post by:
Hello, I have combobox with a selectedindexchanged method that seems to be called when starting the application, launching the form with the combobox and making a change in the drop down box of...
0
by: BillCo | last post by:
I'm a C# Newbie, so if I've missed the obvious here go easy!!! I have a form opened from a MDI parent. The form has a data bound combo box, with a SelectedIndexChanged event (fills a list view...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.