Click here to Skip to main content
15,906,341 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: creating a Form Having Return Value Pin
Hesham Amin27-Mar-04 3:07
Hesham Amin27-Mar-04 3:07 
GeneralRe: creating a Form Having Return Value Pin
Pradeep C27-Mar-04 5:49
Pradeep C27-Mar-04 5:49 
GeneralRe: creating a Form Having Return Value Pin
xstoneheartx28-Mar-04 9:51
xstoneheartx28-Mar-04 9:51 
GeneralRe: creating a Form Having Return Value Pin
Hesham Amin28-Mar-04 11:36
Hesham Amin28-Mar-04 11:36 
GeneralRe: creating a Form Having Return Value Pin
xstoneheartx28-Mar-04 13:33
xstoneheartx28-Mar-04 13:33 
GeneralRe: creating a Form Having Return Value Pin
Randy S29-Mar-04 12:50
Randy S29-Mar-04 12:50 
GeneralRe: creating a Form Having Return Value Pin
jcs200430-Mar-04 19:20
jcs200430-Mar-04 19:20 
QuestionBug In VB.NET Compiler? Pin
Michael Russell26-Mar-04 12:48
Michael Russell26-Mar-04 12:48 
One of the features that I really like about Visual Basic .NET is the ability to declare ReadOnly arrays of value types. However, use of this feature can cause Visual Basic .NET to emit an invalid assembly.

To demonstrate what I'm talking about, let's construct a simple lookup table. The table in question maps integers to doubles and strings, never changes, and does not have an available formula to allow calculations.

Because the LUT needs to be available from launch, a ReadOnly array is created.

<br />
Public Structure LUTItem<br />
  Dim D As Double<br />
  Dim S As String<br />
  Sub New(DValue As Double, SValue As String)<br />
    Me.D = DValue<br />
    Me.S = SValue<br />
  End Sub<br />
End Structure<br />
<br />
Public ReadOnly LUTS() As LUTItem = { _<br />
  New LUTItem(0.03,"A number"), _<br />
  New LUTItem(0.91,"Another number" }<br />


For small arrays, this works wonderfully. However, when you pass around 30,000 items in your array, two things happen:

1) Visual Studio .NET gets heinously slow after every change to the file as it recompiles the file.
2) When you build, the build is successful, but when you run, you are told that the assembly is not valid.

So, my question is this: why is there a disconnect here?

If this particular structure is invalid for the runtime, why does it compile without errors or warnings?
If this particular structure is valid for the runtime, why does the CLR call it an invalid assembly?

Note: I know that creating a massive LUT that way in the assembly is poor coding style. However, when porting software, it is often easier to do a straight port first, then enhance later. I encountered this porting a C++ library to VB.NET when I moved over a 48,000+ element array of structs used in the code that included function pointers and data to pass to the function pointers. Because it was a const array, I was trying to keep a similar access modifier in case any changes I made to the library inadvertently changed values in the array. Besides, who wants to create 48,000+ delegates while loading a file?
AnswerRe: Bug In VB.NET Compiler? Pin
Dave Kreskowiak26-Mar-04 14:55
mveDave Kreskowiak26-Mar-04 14:55 
GeneralRe: Bug In VB.NET Compiler? Pin
Michael Russell26-Mar-04 15:09
Michael Russell26-Mar-04 15:09 
GeneralDynamic Context Menus not appearing in My Computer Pin
Brad Mathews26-Mar-04 12:39
Brad Mathews26-Mar-04 12:39 
GeneralPassing a UserControl to a standard module Pin
Hesham Amin26-Mar-04 7:05
Hesham Amin26-Mar-04 7:05 
GeneralRe: Passing a UserControl to a standard module Pin
Dave Kreskowiak26-Mar-04 7:55
mveDave Kreskowiak26-Mar-04 7:55 
GeneralRe: Passing a UserControl to a standard module Pin
Hesham Amin26-Mar-04 10:56
Hesham Amin26-Mar-04 10:56 
GeneralRe: Passing a UserControl to a standard module Pin
Dave Kreskowiak26-Mar-04 14:41
mveDave Kreskowiak26-Mar-04 14:41 
GeneralRe: Passing a UserControl to a standard module Pin
Hesham Amin26-Mar-04 23:19
Hesham Amin26-Mar-04 23:19 
Generalusing DirectSS text-to-speech control Pin
Cluniac26-Mar-04 6:25
Cluniac26-Mar-04 6:25 
GeneralDeactivate floppy Disk Device Pin
monivong26-Mar-04 5:11
monivong26-Mar-04 5:11 
GeneralDeacivate floppy Disk Device Pin
monivong26-Mar-04 5:01
monivong26-Mar-04 5:01 
GeneralRe: Deacivate floppy Disk Device Pin
Dave Kreskowiak26-Mar-04 7:51
mveDave Kreskowiak26-Mar-04 7:51 
GeneralProperty description tooltip Pin
800XL26-Mar-04 3:56
800XL26-Mar-04 3:56 
GeneralRe: Property description tooltip Pin
Dave Kreskowiak26-Mar-04 4:19
mveDave Kreskowiak26-Mar-04 4:19 
QuestionHow do you insert a row at a time? Pin
hounetdev26-Mar-04 3:16
hounetdev26-Mar-04 3:16 
AnswerRe: How do you insert a row at a time? Pin
super_coding27-Mar-04 3:40
super_coding27-Mar-04 3:40 
GeneralRe: How do you insert a row at a time? Pin
Pradeep C27-Mar-04 5:09
Pradeep C27-Mar-04 5:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.