 | SearchForum Home |  |
 | |  |
 | |  |
 | |  |
 | |  |
 |
|
|
| Application Code not working in Desktop Mode |
|
|
Hello everyone.
I have written a very small app to test the Dual Mode apps. The app is just a form with a ListBox in it, loaded with three items (defined at design time). When the user clicks on one item, the selected item's text is show in a label.
The code is:
Box1_SelectedIndexChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
'mostrar el label seleccionado
If ListBox1.SelectedIndex > -1 Then
Label1.Text = ListBox1.Items(ListBox1.SelectedIndex)
Else
Label1.Text = ""
End If
End Sub
However, when the application is run in Desktop mode, this code is never executed, I mean the event SelectedIndexChanged never is rised.
So what I did is use the Clicked event insted. This time, the code is executed but the SelectedIndex value is always -1 no matter the item you selected.
Private Sub ListBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.Click
'mostrar el label seleccionado
If ListBox1.SelectedIndex > -1 Then
Label1.Text = ListBox1.Items(ListBox1.SelectedIndex)
Else
Label1.Text = ""
End If
End Sub
Thanks in advance for your help. |
|
|
|
 |  |
|
|
| Re: Application Code not working in Desktop Mode |
|
|
Hi,
I suggest that you check if the the event handler Box1_SelectedIndexChanged1 is registered for the SelectedIndex event. Perhaps another (empty) event handler is registered.
Gail
|
|
|
|
 |  |
|
|
| Re: Application Code not working in Desktop Mode |
|
|
Hello Gail.
The SelectedIndex is registered. It works when I run the application in the web browser but it doesn't when I run it in Desktop Application mode.
I'm using Visual Studio 2008 and Visual WebGUI for Framework 3.5. However, I have tried the same code usign VS 2005 and the corresponding version of Visual WebGUI and the code works fine in both modes. So it might be some bug in the newer version.
Thanks a lot for your help. |
|
|
|
 |  |
|
|
| Re: Application Code not working in Desktop Mode |
|
|
Which version of VWG were you using in your VS 2005 runs? Just to make sure I've got it correct, the code worked in as both a VWG and WinForms application with VS 2005 but the WinForms app failed with VS 2008?
Gail |
|
|
|
 |  |
|
|
| Re: Application Code not working in Desktop Mode |
|
|
Exactly Gail.
The code does run both like winforms app and web app, when I use VS 2005 and Visual WebGui SDK (for .NET 2.0).
However, using VS 2008 and Visual WebGui SDK (for .NET 3.5), I'm able to run the application in both modes (like winforms app and web app) but the handler for the event SelectedIndexChanged of the listbox I'm using is never executed. If I try to use the Click event, the SelectedIndex is always -1.
Thanks a lot.
|
|
|
|
|  |
 | |  |
 | |  |
 | |  |
|