Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,187 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,124 people online right now. Registration is fast and FREE... Join Now!




Going backwards from .net to vb6

 
Reply to this topicStart new topic

Going backwards from .net to vb6, selection in combobox doesnt cause an event

alex04032
23 Sep, 2007 - 05:44 PM
Post #1

New D.I.C Head
*

Joined: 14 Sep, 2007
Posts: 4


My Contributions
Going backwards to vb6 with combobox

--------------------------------------------------------------------------------

My simple program worked fine in Vb.net 2005. Specifically, selecting from a dropdown combobox causes the associated subroutine to execute simple commands.... like change variable values, etc. This is really simple stuff.

But my project needed a dll from outside that was only compatible with vb6 and would not migrate. So, I unloaded vb2005 from my PC and installed vb6.

o.k. now my very simple program loads fine and debugs gine, but upon user selection in the drop-down combobox.... nothing happens. Apparently, the subroutine is not called.... selection from the drop down doesent cause anything to happen.

Here is some of my code. The name of the comboxbox is "Combo2".

CODE

Private Sub Combo2_Change()
MsgBox ("hi again")
Select Case Combo2.Index
Case 0
Timer1.Interval = 1000
Case 1
Timer1.Interval = 2000
Case 2
Timer1.Interval = 5000
Case 3
Timer1.Interval = 10000
End Select
MsgBox (Combo2.Index)
TimerInterval = Timer1.Interval / 1000
Option1.Text = Timer1.Interval & TimerInterval
MsgBox = Timer1.Interval
End Sub


Help...help... HELP !!
User is offlineProfile CardPM
+Quote Post

Daiken
RE: Going Backwards From .net To Vb6
23 Sep, 2007 - 06:15 PM
Post #2

New D.I.C Head
*

Joined: 22 Sep, 2007
Posts: 27


My Contributions
I don't think it's possible for any function or method inside of an older class library to be compatible with vb 6 but not with vb.net.
You can use late binding in vb.net so even older non strongly typed objects shouldn't be a problem.

Maybe the issue here is that .net integer types are the equivalent to vb 6 long types.

So when you are passing values into a method of that .dll you were talking about, try to replace all "long" types with "int" types when calling that method with vb.net.

Let me know if that was it.

User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Going Backwards From .net To Vb6
23 Sep, 2007 - 11:19 PM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,906



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
You're using the wrong Event.
Use the Combo2_Click() Event and everything will work just fine.
User is offlineProfile CardPM
+Quote Post

alex04032
RE: Going Backwards From .net To Vb6
24 Sep, 2007 - 03:00 AM
Post #4

New D.I.C Head
*

Joined: 14 Sep, 2007
Posts: 4


My Contributions
Thank you born2c0de, that solved it !

I need to get a vb6 documention book.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Going Backwards From .net To Vb6
24 Sep, 2007 - 05:03 AM
Post #5

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Its weird that this is even working for you checking the Index Property, since the Index Property of a VB6 ComboBox is an Array. Instead of Combo2.Index it should be Combo2.ListIndex. When I tried it with Index I got a runtime error, but with ListIndex it worked just fine.

CODE

Private Sub Combo2_Click()
    MsgBox ("hi again")
    Select Case Combo2.ListIndex
        Case 0
        Timer1.Interval = 1000
    Case 1
        Timer1.Interval = 2000
    Case 2
        Timer1.Interval = 5000
    Case 3
        Timer1.Interval = 10000
    End Select
    MsgBox (Combo2.Index)
    TimerInterval = Timer1.Interval / 1000
    Option1.Text = Timer1.Interval & TimerInterval
    MsgBox = Timer1.Interval
    End Sub

User is offlineProfile CardPM
+Quote Post

alex04032
RE: Going Backwards From .net To Vb6
24 Sep, 2007 - 03:48 PM
Post #6

New D.I.C Head
*

Joined: 14 Sep, 2007
Posts: 4


My Contributions
I suspect that unloading VB.net, then installing the older VB6 caused some DLL's to be mixed up.






QUOTE(PsychoCoder @ 24 Sep, 2007 - 06:03 AM) *

Its weird that this is even working for you checking the Index Property, since the Index Property of a VB6 ComboBox is an Array. Instead of Combo2.Index it should be Combo2.ListIndex. When I tried it with Index I got a runtime error, but with ListIndex it worked just fine.

CODE

Private Sub Combo2_Click()
    MsgBox ("hi again")
    Select Case Combo2.ListIndex
        Case 0
        Timer1.Interval = 1000
    Case 1
        Timer1.Interval = 2000
    Case 2
        Timer1.Interval = 5000
    Case 3
        Timer1.Interval = 10000
    End Select
    MsgBox (Combo2.Index)
    TimerInterval = Timer1.Interval / 1000
    Option1.Text = Timer1.Interval & TimerInterval
    MsgBox = Timer1.Interval
    End Sub



User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 01:18AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month