VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

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




VB6 or VB.Net?

2 Pages V < 1 2  

VB6 or VB.Net?, Ways of telling in the code.

PsychoCoder

RE: VB6 Or VB.Net?

5 Apr, 2009 - 08:38 AM
Post #21

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 14,920



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

My Contributions
@eyes_angel You should choose VB.NET over VB6 for many reasons, like VB6 is a dieing language not supported by Microsoft anymore, VB.NET is easier to use, more powerful, object orientated, an dis an all around better language.

VB6 is like a kids toy (always has been always will be), but I don't understanding the statement that it's "easier to understand" than VB.NET, that statement baffles me. I've been using VB since VB3 and let me tell you I avoid it like the plague (knowing how to use it and actually using it are two different stories).

Trust me, if you want to be a programmer continue learning the .Net world as VB6 will get you nowhere smile.gif
User is offlineProfile CardPM
+Quote Post

firebolt

RE: VB6 Or VB.Net?

6 Apr, 2009 - 04:58 AM
Post #22

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,476



Thanked: 77 times
Dream Kudos: 1675
My Contributions
Agreed. Dunno why my school is still using VB6.
User is offlineProfile CardPM
+Quote Post

searockruz

RE: VB6 Or VB.Net?

6 Apr, 2009 - 05:12 AM
Post #23

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
vb 6 is light vb.net is heavy in term of computer resources
User is offlineProfile CardPM
+Quote Post

firebolt

RE: VB6 Or VB.Net?

6 Apr, 2009 - 05:16 AM
Post #24

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,476



Thanked: 77 times
Dream Kudos: 1675
My Contributions
Also agreed.
User is offlineProfile CardPM
+Quote Post

paperclipmuffin

RE: VB6 Or VB.Net?

8 May, 2009 - 10:43 PM
Post #25

WinWinWinWindows?
Group Icon

Joined: 16 Apr, 2009
Posts: 899



Thanked: 9 times
Dream Kudos: 400
My Contributions
The only reason I use VB 6.0 is my dad had a copy of it from back in the ark, when it first came out. smile.gif
User is offlineProfile CardPM
+Quote Post

DocRabbit

RE: VB6 Or VB.Net?

9 May, 2009 - 02:58 AM
Post #26

New D.I.C Head
*

Joined: 9 May, 2009
Posts: 4

QUOTE(eyes_angel @ 5 Apr, 2009 - 06:21 AM) *

QUOTE(firebolt @ 4 Apr, 2009 - 02:00 AM) *

vb6 is easier to understand and use by a factor of 4 compared to VB.NET but i muset agree, VB.NET had much better and more features than VB6

yup vb .net is better but it is true only wen i need to use its all features.i want to know wen i m going to design a simple interface then y i should choose vb .net y nt vb6 wen it is simple to use and understand.pls reply if u hv proper ans, y to go wid vb6 while designing a simple interface.

If it can be done in vb6, has all the functionality you need for now and every more (rarely ever seen this occur at time of writing a program), produces no bugs what-so-ever, then yes I would use vb6 over VBNet.

Been programming since the only windows you saw were the ones on your office wall and c:\>_ was your only screen companion. In all my years of programming, have yet to ever have one single program to pass all the criteria I stated above. So, in other words, even if it is going to be a plain simple ferrari, its still better than a chevette.(Sorry GM, but even you guys would admit this)
User is offlineProfile CardPM
+Quote Post

BobRodes

RE: VB6 Or VB.Net?

19 May, 2009 - 04:33 PM
Post #27

New D.I.C Head
*

Joined: 19 May, 2009
Posts: 4

QUOTE(eyes_angel @ 5 Apr, 2009 - 06:21 AM) *

QUOTE(firebolt @ 4 Apr, 2009 - 02:00 AM) *

vb6 is easier to understand and use by a factor of 4 compared to VB.NET but i muset agree, VB.NET had much better and more features than VB6

yup vb .net is better but it is true only wen i need to use its all features.i want to know wen i m going to design a simple interface then y i should choose vb .net y nt vb6 wen it is simple to use and understand.pls reply if u hv proper ans, y to go wid vb6 while designing a simple interface.


You might keep in mind that VB6 skills aren't very marketable anymore, whereas VB.Net skills are much more so.
User is offlineProfile CardPM
+Quote Post

BobRodes

RE: VB6 Or VB.Net?

19 May, 2009 - 04:58 PM
Post #28

New D.I.C Head
*

Joined: 19 May, 2009
Posts: 4

QUOTE(PsychoCoder @ 5 Apr, 2009 - 08:38 AM) *


VB6 is like a kids toy (always has been always will be


Here's an example of some code that suggests that VB6 is rather more than a kids' toy. For those interested, it allows customization of the fonts in the MsgBox function. I might add that such a thing is much easier to do in VB.Net, so one could make as strong a case that VB.Net is a kids' toy, too, given its ease of use when you start going deep. I prefer to simply say that both are viable means of meeting serious business requirements.

I have a point for saying this, and I'm not off the topic of the thread. VB6 isn't going to die any time soon! It's going to coexist with VB.Net for quite a while. There are plenty of legacy VB6 applications around, some that are quite sophisticiated (QED), that are running quite well as is. As such, it's unlikely that initiatives on the part of the VB6-is-a-toy pundits to dismantle VB6 applications and rewrite them in .Net will go very far, once the subject of money is broached.

On the other hand, most new software is being written in .Net or Java. So, if you want to make your skills marketable, gain experience in C#, really. We have a whole new set of pundits who believe that C# is more sophsiticated than VB.Net, and one might as well go with the flow of ego. Better yet, learn both. Best of all, learn the .Net framework, because that's where all the functionality is. After a few years, everyone will figure this out, even HR people, and it will be what you need to know.

Bob

CODE
'This code allows font changes and various other format customizations of the standard VB6 MsgBox dialog box.  It
'uses CBT hooking to intercept a MsgBox call, then gets a handle to the MsgBox window as well as its various child
'windows (the label containing the message text, any buttons, and an icon if it exists).  It then resizes the 'window to accommodate the message text and other windows, and repositions the icon and any command buttons.  
'Finally, it positions the msgbox window in the center of the screen.

'General Note: notes are above the line of code to which they apply.

Option Explicit

' Window size and position constants
Private Const ICON_WIDTH As Integer = 32
Private Const BTN_WIDTH As Integer = 75
Private Const BTN_HEIGHT As Integer = 23
Private Const BTN_SPACER As Integer = 6    ' Space between 2 buttons
Private Const STW_OFFSET As Integer = 12   ' Standard window offset, minimum distance one window can be from
                                           ' the edge of its container
                                          
' SendMessage constants that we will use
Private Const WM_SETFONT = &H30
Private Const WM_GETTEXT = &HD

' Necessary constants  for hooking
Private Const HCBT_CREATEWND = 3
Private Const HCBT_ACTIVATE = 5
Private Const WH_CBT = 5

' Working variables that require global scope in hooking module
Private hHook As Long
Private myFont As IFont
Private cPrompt As String
Private hwndStatic As Long
Private ButtonHandles() As Long
Private xPixels As Long
Private yPixels As Long
Private isIcon As Boolean

' The API declarations we need
Private Type SIZE
    cx As Long
    cy As Long
End Type

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
'GETTEXT needs a String argument, SETFONT needs an Any argument, hence 2 declarations for SendMessage
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SendMessageS Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

' Wrapper for the normal MsgBox function
Public Function myMsgBox(Prompt As String, Buttons As VbMsgBoxStyle, ByVal fSize As Integer, ByVal fBold As Boolean, ByVal fItalic As Boolean, ByVal fULine As Boolean, fFaceName As String, Optional Title As String, Optional HelpFile As String, Optional Context As Long, Optional x As Long, Optional y As Long) As Long
'x and y arguments are optional and are in twips.  If not specified, msgbox will use default window sizes
'and positions, which work fine if you are using default font sizes.  If you aren't they may not.
cPrompt = Prompt
Set myFont = New StdFont
myFont.SIZE = fSize ' We can play around with the font to our heart's content here, all in a VB-friendly way
myFont.Bold = fBold
myFont.Italic = fItalic
myFont.Underline = fULine
myFont.Name = fFaceName
'Convert x and y arguments to pixels from twips.  (Twips are the same size no matter what the screen
'resolution; pixels aren't.)
If Not IsMissing(x) Then
    xPixels = Int(x / Screen.TwipsPerPixelX)
End If
If Not IsMissing(y) Then
    yPixels = Int(y / Screen.TwipsPerPixelY)
End If
hHook = SetWindowsHookEx(WH_CBT, AddressOf CBTProc, App.hInstance, 0)
'This will call CBTProc, passing the handle of the MsgBox window to the wParam argument.
myMsgBox = MsgBox(Prompt, Buttons, Title, HelpFile, Context)
End Function

Private Function CBTProc(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim i As Integer
Dim statX As Integer   'X dimension of static (text) window
Dim statY As Integer   'Y dimension of same
Dim cLeft As Integer   'Current Left value for current button, used to position buttons along x axis
Dim rc As RECT          'Used with GetClientRect
If lMsg = HCBT_ACTIVATE Then
    'Immediately unhook (we have the handle we're looking for, and don't want to fire any more CBT events)
    UnhookWindowsHookEx hHook
    'Call EnumChildWindowProc once for each window that is contained in the MsgBox
    EnumChildWindows wParam, AddressOf EnumChildWindowProc, 0
    'Reinitialize the static buttoncount variable, see the proc
    EnumChildWindowProc 0, 1
    'Should always be true, but this prevents an abend if for some reason we fail to get the text window
    If hwndStatic Then
        'If the x parameter has been supplied to the main wrapper, then xPixels <> 0
        If xPixels Then
            With Screen
                'Center the MsgBox window in the screen
                SetWindowPos wParam, 0, (.Width / .TwipsPerPixelX - xPixels) / 2, _
                            (.Height / .TwipsPerPixelY - yPixels) / 2, xPixels, yPixels, 0
            End With
            'Analogous to the ScaleWidth and ScaleHeight properties.  Client rectangle's dimensions are
            'returned to the rc type and exclude the dimensions of the title bar and the borders.
            GetClientRect wParam, rc
            'Calculate x and y values for text window.  If there's an icon, we need to reduce the size of the
            'text window by the width of the icon plus a standard offset value.
            statX = rc.Right - rc.Left - STW_OFFSET * 2 - ((isIcon And 1) * (ICON_WIDTH + STW_OFFSET))
            statY = rc.Bottom - rc.Top - BTN_HEIGHT - STW_OFFSET * 2
            'We need to position the text window along the x axis such that it's a standard offset from the left
            'border of the msgbox, plus the width of the icon and another standard offset if the icon exists.
            SetWindowPos hwndStatic, 0, STW_OFFSET + (isIcon And 1) * (ICON_WIDTH + STW_OFFSET), STW_OFFSET, statX, statY, 0
            isIcon = 0
            'Loop through the button handles, calculating the left border position each time.
            For i = 0 To UBound(ButtonHandles)
                'Current left border is half the container window's width, less the width of half the total
                'number of buttons, plus the offset of the current button in the array.
                cLeft = Int(xPixels / 2 + BTN_WIDTH * (i - (UBound(ButtonHandles) + 1) / 2))
                'Modify the above to add button spacer widths.
                cLeft = cLeft + BTN_SPACER * (i - (UBound(ButtonHandles) - 1) + (UBound(ButtonHandles) Mod 2) / 2)
                'The Y value is 1 standard offset more than the height of the text window.
                SetWindowPos ButtonHandles(i), 0, cLeft, statY + STW_OFFSET, BTN_WIDTH, BTN_HEIGHT, 0
            Next
        End If
        SendMessage hwndStatic, WM_SETFONT, myFont.hFont, True
    End If
End If
CBTProc = 0 ' allow operation to continue
End Function

Private Function EnumChildWindowProc(ByVal hChild As Long, ByVal lParam As Long) As Long
Static ButtonCount As Integer
Dim sLen As Integer
Dim wClass As String
Dim wText As String
Dim rc As RECT
If lParam Then
    ButtonCount = 0     'See the direct call of this proc in CBTProc: resets the ButtonCount variable to 0
    Exit Function
End If
wClass = String(64, 0)
'look up the type of the current window
sLen = GetClassName(hChild, wClass, 63)
wClass = Left(wClass, sLen)
'We have either one or two static windows: optionally the icon (the first window if it's there) and the
'text window (analogous to a label control).
If wClass = "Static" Then
    'If we already have the text window's handle, we don't need to do this anymore.
    If Not hwndStatic Then
        'Find out if the current window's text value is the same as the text passed in to the cPrompt
        'argument in the main wrapper function.  If it is, it's the text window and we store the handle
        'value in hwndStatic.  If it isn't, then it's an icon and we set the isIcon flag.
        wText = String(Len(cPrompt) + 1, 0)
        sLen = SendMessageS(hChild, WM_GETTEXT, 255, wText)
        wText = Left(wText, sLen)
        If wText = cPrompt Then
            hwndStatic = hChild
        Else
            isIcon = True
        End If
    End If
ElseIf wClass = "Button" Then
    'Store the button's handle in the ButtonHandles array
    ReDim Preserve ButtonHandles(ButtonCount)
    ButtonHandles(ButtonCount) = hChild
    ButtonCount = ButtonCount + 1
End If
EnumChildWindowProc = 1  ' Continue enumeration
End Function




QUOTE(firebolt @ 6 Apr, 2009 - 04:58 AM) *

Agreed. Dunno why my school is still using VB6.


Cheaper. smile.gif
User is offlineProfile CardPM
+Quote Post

AdscendJeremy

RE: VB6 Or VB.Net?

26 May, 2009 - 07:09 PM
Post #29

New D.I.C Head
*

Joined: 23 May, 2009
Posts: 18



Thanked: 1 times
My Contributions
VB6 for life wink2.gif
Seriously I don't see any good reason to change to .NET. Maybe for specific types of applications, but VB6 is much easier to use and you can use API calls to do just about anything you want. The .NET code documentation is a nightmare, trying to sort through all of the different namespaces to find the function you're looking for. I used .NET for a couple of apps, and I haven't touched it since. Granted I'm also moving away from VB also and not doing much programming anymore, but switching to .NET reminds me of the opposite experience I had of switching from Perl to PHP. VB6 is like PHP and .NET is like Perl. (Meaning only that VB6 is much easier to work with wink2.gif)
User is offlineProfile CardPM
+Quote Post

Masspwr

RE: VB6 Or VB.Net?

28 May, 2009 - 03:46 AM
Post #30

New D.I.C Head
*

Joined: 26 May, 2009
Posts: 9

Hi.
Well I have used both of these. But I am not really into vb.
However my friends are vb nuts. I ask them what one is better
Vb6 or .net
They use vb6. They all say vb6
I ask why but they kind of say
Because it is
And never give a proper answer.
What is the differences?
Why is which one better.
User is offlineProfile CardPM
+Quote Post

rainbow evil

RE: VB6 Or VB.Net?

15 Jul, 2009 - 07:48 AM
Post #31

New D.I.C Head
*

Joined: 15 Jul, 2009
Posts: 36

I wish I'd seen this post before posting my question about VB.NET in the VB6 section. When I created my account the bar at the top of the screen allowed me to just create a new post in the section I thought it should be in (labelled visual basic in the drop down menu). After posting I find this topic and wished it was on the post new thread page so I don't waste moderator's time. Sorry about wrongly posting, I renamed the topic to alert moderators to this fact so hopefully I helped them there.

Sorry!
User is offlineProfile CardPM
+Quote Post

s69

RE: VB6 Or VB.Net?

21 Jul, 2009 - 02:01 PM
Post #32

New D.I.C Head
*

Joined: 5 Apr, 2009
Posts: 4

I need to write applications that will run under WinPE v2 (VistaPE) which does not support .NET, so vb.Net is not a choice. On the other hand, vb6 will only compile to 32-bit code...

User is offlineProfile CardPM
+Quote Post

babysitter

RE: VB6 Or VB.Net?

12 Aug, 2009 - 12:47 AM
Post #33

New D.I.C Head
*

Joined: 6 Aug, 2009
Posts: 25

Hee..I think I've mistakenly posted some topics here.They should be in VB.NET. wub.gif
User is offlineProfile CardPM
+Quote Post

NoBrain

RE: VB6 Or VB.Net?

28 Aug, 2009 - 02:06 PM
Post #34

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,214



Thanked: 39 times
Dream Kudos: 125
My Contributions
QUOTE
The .NET code documentation is a nightmare, trying to sort through all of the different namespaces to find the function you're looking for.


Agree total nightmare. I better learn c++ then vb.net
User is offlineProfile CardPM
+Quote Post

karimi

RE: VB6 Or VB.Net?

17 Sep, 2009 - 07:54 PM
Post #35

New D.I.C Head
*

Joined: 29 May, 2009
Posts: 24



Thanked: 1 times
My Contributions
I want to know about Nix, and Mono. From where i can get info about these.
User is online!Profile CardPM
+Quote Post

NoBrain

RE: VB6 Or VB.Net?

27 Sep, 2009 - 07:54 AM
Post #36

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,214



Thanked: 39 times
Dream Kudos: 125
My Contributions
you can try asking questions in this forum

http://www.dreamincode.net/forums/showforum62.htm
User is offlineProfile CardPM
+Quote Post

bigjeff5

RE: VB6 Or VB.Net?

16 Oct, 2009 - 08:13 AM
Post #37

New D.I.C Head
*

Joined: 15 Oct, 2009
Posts: 1

QUOTE(DocRabbit @ 9 May, 2009 - 02:58 AM) *

QUOTE(eyes_angel @ 5 Apr, 2009 - 06:21 AM) *

QUOTE(firebolt @ 4 Apr, 2009 - 02:00 AM) *

vb6 is easier to understand and use by a factor of 4 compared to VB.NET but i muset agree, VB.NET had much better and more features than VB6

yup vb .net is better but it is true only wen i need to use its all features.i want to know wen i m going to design a simple interface then y i should choose vb .net y nt vb6 wen it is simple to use and understand.pls reply if u hv proper ans, y to go wid vb6 while designing a simple interface.

If it can be done in vb6, has all the functionality you need for now and every more (rarely ever seen this occur at time of writing a program), produces no bugs what-so-ever, then yes I would use vb6 over VBNet.

Been programming since the only windows you saw were the ones on your office wall and c:\>_ was your only screen companion. In all my years of programming, have yet to ever have one single program to pass all the criteria I stated above. So, in other words, even if it is going to be a plain simple ferrari, its still better than a chevette.(Sorry GM, but even you guys would admit this)


(First post, wee!)

I'm a very green VB programmer and I prefer .Net to 6 (I've been tasked with supporting a VB6 app and am currently stuck in dll hell), but I work with an extremely experienced programmer who prefers VB6 for most things because, oddly enough, he can do almost anything imaginable under VB6. Bear with me if I sound like I'm a bit in awe with this guy, I kindof am. Every time I talk to him he blows my mind with something else. Anyway.

To give you an idea about my co-worker's programming level, he got into the industry as a computer tech in the Army back when computers filled whole rooms. He saw the rise of punch cards and began programming then. Due to the particular industry he and I both work in, he is still today regularly writing in Assembly, and even occasionally in machine language for particular processors we (him more than me) come into contact with. He commonly writes in C, C++, VB6 and VB.Net. As far as I know he doesn't mess with Ruby, Java, or any of the scripting languages, but I could be wrong given the sheer amount this guy spends writing code. He's the kind of programmer who, if he doesn't like the way someone designed a product, he will dissasemble it and re-write it the way he wants it to work (he did this with a piece of firmware for some industrial equipment and the company turned around and bought the source code off him so they could distribute it themselves).

So when a guy like that tells me he prefers to work in VB6 over everything else, first my face goes something like 0.o, then I pay attention. He is pulling me into a project now (more as education for me, since I'm sure I'll just be slowing him down in a major way) where he is writing an extremely tiny operating system in VB6 to put on industrial equipment. He wrote a custom compiler for VB6 to compile everything into Assembly, and from there he can compile it into various machine code formats.

It should be an interesting experience, and apparently you can't count VB6 out yet if you can do this sort of thing with it. Because it is certainly more difficult in .Net (though apparently he has a custom compiler for that, too).
User is offlineProfile CardPM
+Quote Post

2 Pages V < 1 2
Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 08:31AM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month