|
First, you're not using arrays correctly. The following code does not create an array. It merely declares a reference to an Array initialized to Nothing.
Dim ansArray As Array
Arrays are defined like this...
Dim myNumbers(2) As Integer ' Creates an array with 3 elements.
Dim myYears() As Integer = {2000, 2005} ' Initializes a new array with 2 elements.
Looking at your MakeChild() code, you really shouldn't use an array. Arrays have a fixed size, meaning you have to determine how many rows will be returned from the database before you can allocate the array. Or you have to Redim the array on every pass in the loop, which is very inneficient.
Instead, you should use a data structure like the ArrayList which allows you to Add new elements to it. You could then Add the returned ArrayList to the parent's ArrayList.
Now about your error "Object variable or With block variable not set". That sounds like a separate coding error. Double click on the error message to find exactly where in your code this problem is occuring.
-- modified at 19:55 Tuesday 17th January, 2006
|
|
|
|
|
Thanks for your help! I'm pretty new to VB.Net and I guess I've picked up some misconceptions about arrays from some... sloppier languages I've been using for a while. But I changed the arrays to array lists and everything is behaving itself now.
Thanks again!
-------------------
abort, retry, fail?
|
|
|
|
|
Hi everyone,
I try to a display a .txt file in window's textbox or rich textbox. The text file has contents line by line aligned perfectly when using NotePad to view and print it. But when I display this .txt file in textbox or rich textbox the alignment all messed up. Please help me to solve this problem.
Thanks in advance.
nina
|
|
|
|
|
It's all messed up because your using the wrong type of font. In Notepad, you're always using a fixed-width font, like Lucida Console. Every character, and white-space character, is the same width.
By default, in a TextBox and RichTextBox, the font is a proportionally spaced font. Each character and white-space character takes up only as much space as the actual width of the glyphs. A 'W' is much wider than a '.' All you have to do is change the font of the TextBox or RichTextBox to a fixed-width font.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you so much.
Nina
|
|
|
|
|
Dave, could you email me pls ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sure. I'll be home in an hour. It's a 50 mile drive to work... YUK!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have 2 forms. When I click on a button of form 1 I want to open form 2 and close form1.
The problem comes when form 2 closes when form 1 closes.
One solution will be to define a class and define the forms in it and not in the form 1, but I don't know how to do it.
Someone can help me to do this or give me another solution?
Thank you
|
|
|
|
|
Why are you trying to do this?
Is there a form 0? If so, you can have form 1 send a message to form 0 to open form 2. If there is no form 0, then form 1 is the main form, and when it closes, the application closes. This is why form 2 closes, too.
If you want app 1 to close, try making form 2 a separate app, and execute it from app 1.
Roy.
|
|
|
|
|
hi dear,
i can help u out. create a module . in the module create a main function
module a
sub main()
dim f as new form1
f.showDialog()
end sub
end module
and procedd in the same way as u were doing . the onlu thing u need to change now is ur startup object . set the startup object of the project to sub main and not to any form
(Vinit Jain)
|
|
|
|
|
Thanks to both, but it doesn't work. In 2005 express edition I can't (or don't know) select "sub main" as the startup object.
Roy Heil wrote: Why are you trying to do this?
How you work with multiple forms then without using an mdi environement?
|
|
|
|
|
hi
ok u r working on .net 2005 express edition. i told u the code that would work in .net 2003. for dot net 2005 u dont hv to wory at all . in the properties of the project u have to set the shutdown mode of the application to "when the last form closes"
karan jain
|
|
|
|
|
OK!! this works well!!
There is any inconvenience doing this?
|
|
|
|
|
Does anyone know where I caqn go to get a call to object or library for a list of NT users within a domain?
Bob Zagars
Senior Software Engineer
|
|
|
|
|
I wrote a class in vb.net with the necessary modifications so it can be accessed as COM object from other apps such as VB6.
VB6 can access my class and call all methods with no problems. However, when a VB6 user is debugging his/her code and stops his/her running program, the destructor of my COM class doesn't get called (Sub Finalize). My class already has a Dispose method that takes care of all necessary cleanup; however, this method can be called only when VB6 code is running and if user clicks Stop button my class destructor doesn't get called.
Please advice because only way to do clean up right now is to completely close VB6 app and restart again.
|
|
|
|
|
I want to developed application for automatically detecting Video format .can any one help regrding above problem.Pls do reply on frum or personally mail me .
Thanks & Regards,
Amit More
amit.more@pictureal.net
|
|
|
|
|
that's not too hard, at least how i'm thinking of it.
First get the file name however you plan on getting it - filesystem, URL, etc.
<br />
DIM Filename as String = 'get your filename here<br />
'get the last 3 letters/extension of the filename<br />
DIM Extension as String = Filename.Substring(Filename.Length - 3, 3) <br />
<br />
'check extension against known types<br />
Select Case Extension<br />
Case "wmv"<br />
Response.Write("File type is wmv")<br />
Case "avi"<br />
Response.Write("File type is avi")<br />
'etc etc etc<br />
Case Else<br />
Response.Write("Unrecognized video format.")<br />
End Select<br />
Hope that helps.
-------------------
abort, retry, fail?
|
|
|
|
|
I have this problem everytime I run VB.Net copying values onto an Excel spreadsheet.
I do the following:
Dim EXLApp As New Excel.Application
then to finish off
EXLApp .Workbooks.Close()
EXLApp .Application.Quit()
When I look in my task manager Excel is still there. If I run my procedure say 10 times, excel is loaded 10 times. Then I start have Excel problems when load a spreadsheet.
Any ideas or what am I doing wrong?
Thanks in advance
|
|
|
|
|
set your excel object reference to nothing after you call the quit method:
EXLApp.Application.Quit()
Set EXLApp = Nothing
Eric Dahlvang-Programmer
|
|
|
|
|
I have a datagrid that I have populated from a database obviously using an SQL statement. What I want to be able to do, is have the data within the datagrid be accessable.
E.G I want the cells within the datagrid to be underlined and clickable. So that when I click on that cell, it will do something else based on the value of that cell.
Does that make sense?
Thanks for any help.
|
|
|
|
|
You're going to have to manually layout (at least certain parts of) your datagrid using template columns item templates, and turn off AutoGenerateColumns in the properties of the datagrid (if it's on).
A short example would be something like this (inside the html or your datagrid):
<asp:TemplateColumn HeaderText="Link">
<ItemTemplate>
<a href='<%# Container.DataItem("LinkURL") %>'><%# Container.DataItem("LinkName")%></a>
</ItemTemplate>
</asp:TemplateColumn>
Note that LinkName and LinkURL are the names of the fields you're using in your SQL select statement.
Something along those lines should work.
-------------------
abort, retry, fail?
|
|
|
|
|
How can I connect to sql server and (Select - update - insert -Delete) the data using other method than Dataset. I want the connection to be directly to the database and not cache as dataset.
Is it possible to use sqldataadapter to retrive ,update , insert and delete data?
Thanks
|
|
|
|
|
Use an SqlCommand object. Put an SQL query or a stored procedure call in it, and use the ExecuteReader method (for select) or ExecureNonQuery method (for update/insert/delete) to call it.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hi all,
Is there any method by which i can find out if a USB cable is connected to USB port through VB program. It would of great help if someone can guide me with this.
Thanx in advance,
sushma
|
|
|
|