Click here to Skip to main content
15,904,926 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer15-Oct-07 3:40
VB.Net Developer15-Oct-07 3:40 
GeneralRe: Copy files from one folder to another Pin
Eric Georgiades15-Oct-07 3:50
Eric Georgiades15-Oct-07 3:50 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer15-Oct-07 3:53
VB.Net Developer15-Oct-07 3:53 
AnswerRe: Copy files from one folder to another Pin
Abhijit Jana15-Oct-07 4:25
professionalAbhijit Jana15-Oct-07 4:25 
GeneralRe: Copy files from one folder to another Pin
VB.Net Developer16-Oct-07 1:42
VB.Net Developer16-Oct-07 1:42 
QuestionDownload Attachment from Email using VB,NET [modified] Pin
VB.Net Developer15-Oct-07 2:56
VB.Net Developer15-Oct-07 2:56 
AnswerRe: Download Attachment from Email using VB,NET Pin
DigiOz Multimedia15-Oct-07 10:12
DigiOz Multimedia15-Oct-07 10:12 
QuestionWeird memory problem Pin
Skippy II15-Oct-07 2:47
Skippy II15-Oct-07 2:47 
Hi all,

I have 2 forms (Form1 and Form2) in my app. Form1 has 2 buttons (Button1 and Button2). The Load event of Form2 has this code:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
    Dim obj(,,) As Object<br />
    ReDim obj(50, 24000, 100)<br />
End Sub<br />


When you click Button1 on Form1 this code is executed:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
    Dim obj(,,) As Object<br />
    ReDim obj(50, 25000, 100)<br />
End Sub<br />


The ReDim statement gives an OutOfMemoryException. When I change the statement to

ReDim obj(50, 24000, 100)

the exception isn't thrown anymore.

When Button2 is clicked, this code is executed:

Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
    For tel As Integer = 1 To 10<br />
        Dim f As New Form2<br />
        f.Show()<br />
    Next<br />
End Sub<br />


This works just fine.
After searching the web for answers, I think it may have to do with the heap size, but I'm not sure at all.

My questions:
Why is the Button1 code giving an exception and why is this not happening when clicking Button2?
What should I do to make the Button1 code work without throwing an exception?

Skippy II
AnswerRe: Weird memory problem [modified] Pin
Dave Kreskowiak15-Oct-07 6:08
mveDave Kreskowiak15-Oct-07 6:08 
GeneralRe: Weird memory problem Pin
Skippy II15-Oct-07 6:52
Skippy II15-Oct-07 6:52 
GeneralRe: Weird memory problem Pin
Dave Kreskowiak15-Oct-07 8:06
mveDave Kreskowiak15-Oct-07 8:06 
GeneralRe: Weird memory problem Pin
Skippy II15-Oct-07 9:03
Skippy II15-Oct-07 9:03 
GeneralRe: Weird memory problem Pin
Luc Pattyn15-Oct-07 9:27
sitebuilderLuc Pattyn15-Oct-07 9:27 
GeneralRe: Weird memory problem Pin
Skippy II15-Oct-07 10:26
Skippy II15-Oct-07 10:26 
GeneralRe: Weird memory problem Pin
Luc Pattyn15-Oct-07 10:55
sitebuilderLuc Pattyn15-Oct-07 10:55 
GeneralRe: Weird memory problem Pin
Skippy II15-Oct-07 11:22
Skippy II15-Oct-07 11:22 
GeneralRe: Weird memory problem Pin
Dave Kreskowiak15-Oct-07 12:15
mveDave Kreskowiak15-Oct-07 12:15 
Questionfind motherboard id using system.win32 class in vb.net Pin
jayesh l lolariya15-Oct-07 1:26
professionaljayesh l lolariya15-Oct-07 1:26 
AnswerRe: find motherboard id using system.win32 class in vb.net Pin
vidya11015-Oct-07 1:34
vidya11015-Oct-07 1:34 
GeneralRe: find motherboard id using system.win32 class in vb.net Pin
jayesh l lolariya15-Oct-07 21:11
professionaljayesh l lolariya15-Oct-07 21:11 
GeneralRe: find motherboard id using system.win32 class in vb.net Pin
vidya11015-Oct-07 22:59
vidya11015-Oct-07 22:59 
Questioncreate form with a textbox at runtime Pin
sankalp singh15-Oct-07 1:12
sankalp singh15-Oct-07 1:12 
AnswerRe: create form with a textbox at runtime Pin
sankalp singh15-Oct-07 1:15
sankalp singh15-Oct-07 1:15 
AnswerRe: create form with a textbox at runtime Pin
SHatchard15-Oct-07 1:44
SHatchard15-Oct-07 1:44 
GeneralRe: create form with a textbox at runtime Pin
sankalp singh15-Oct-07 1:50
sankalp singh15-Oct-07 1:50 

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.