Re: Conversion Problem
- From: "John" <no-email-supplied@xxxxxxxxxxx>
- Date: Fri, 11 Jul 2008 08:24:20 +0100
You are quite correct in saying i am not familiar enough with the framework and .NET. My problem seems to be i'm trying to do the same things in vb.net as i did in vb6 rather than taking the new approach to it. Frustrating never the less.
It would certainly assist if the help provided more practical examples. I suppose i should buy a book!
"Tom Shelton" <tom_shelton@xxxxxxxxxxxxxxxxxx> wrote in message news:3rmdnZmPI7VnFOvVnZ2dnUVZ_qXinZ2d@xxxxxxxxxxxxxx
On 2008-07-10, John <no-email-supplied@xxxxxxxxxxx> wrote:glad to know its not just me, i would not even have considered using vb8 but
i do like the new updated appearance and i was worried that eventually vb6
would not work with microsofts operating system updates.
practically everything i try and do that took a few seconds in vb6 takes
hours in this to sort out and then like this example i have spent nearly the
whole day trying to achieve something that cannot be done simply (the best
solution being create a vb6 dll to handle it (says it all really doesn't
it). I have many more examples, no contol arrays so you have to build them
at run time and spend hours trying to get the layout correct, - printing -
you cannot easily specify a new page without going into a recursive print
handler which takes more time trying to handle your printing, etc etc all
simple stuff but a nightmare in this product.
LOL... The problem is John, that you are not familiar enough with the
framework and .NET. Once you become so, on the whole things are MUCH easier
then VB6. I know, I spent years doing VB work. I'm not claiming every thing
is easier, just most.
Your example of control arrays is pretty funny - I
don't even miss them. First off, the main reason in VB.CLASSIC for control
arrays was 1) common event handling and 2) avoiding the 256 unique control
names per form limit (or was it 255?). 2 doesn't apply in VB.NET and 1 is
handled by the fact that VB.NET events allow an event to be assigned to
multiple controls (heck, they don't even have to be the same type)...
' you can do this in the ide - just select all of the controls you want, go
' to the event tab in the properties window and add the handler - the ide will
' automatically add the handles list :)
Private Sub Button_Click (ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click, Button2.Click, Button3.Click
Dim clickedButton As Button = DirectCast (sender, Button)
' do button stuff
End Sub
There are times that using index's to access a control are helpful... And
even that is a fairly simple task.
Public Class MyForm
Inherits System.Windows.Forms.Form
Private buttons() As Button = new Button() {Button1, Button2, Button3}
...
Private Sub DoCoolStuff(ByVal btnIndex As Integer)
Dim theButton As Button = buttons(btnIndex)
' do cool stuff with the button
End Sub
End Class
Or you can index them from the containser controls collection at runtime by
the name:
Dim theButton As Button = DirectCast(Me.Controls("theButton"), Button)
There is no need to dynamically generate controls... You just have to
understand the differences and the capabilites of VB.NET and then you don't
have these types of issues (well, at least not as often).
As for your file issue, I only was half joking about your file access - the
fact is that .NET is a different target platform then VB6. VB6 targeted COM
and so it has a lot of COM'isms - such as SafeArrays - and so in some ways is
not compatable. Personally, if I were you I would create a VB6 component that
would be able to convert the files into a more .NET friendly format and then
access them using the System.IO namespace classes. The FileXXX VB.NET native
functions are crap...
--
Tom Shelton
.
- References:
- Conversion Problem
- From: John
- Re: Conversion Problem
- From: Patrice
- Re: Conversion Problem
- From: John
- Re: Conversion Problem
- From: Ken Halter
- Re: Conversion Problem
- From: John
- Re: Conversion Problem
- From: Tom Shelton
- Conversion Problem
- Prev by Date: Re: Help With Managing Dynamic controls
- Next by Date: Re: Conversion Problem
- Previous by thread: Re: Conversion Problem
- Next by thread: Re: Conversion Problem
- Index(es):
Relevant Pages
|