Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2006, 12:19 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help needed on a program

I am writing a program that I picked up from somebody else and I have a couple of questions. I run the program and when I try to execute it I am hit with an error that tells me in this Sub that the Object Reference is not set to an instance of an object. The tips it gives me are the following...

1) Use the "new" keyword to create an object instance.
2) Check to determine if the object is null before calling the method.
3) Get general help for this exception.

It points to the line that I have bolded below. Somebody help please!

Sub MoveIt(ByVal inpStartLoc AsInteger, ByVal outLength AsInteger, ByRef buildString AsString)
Dim intFrom AsInteger = inpStartLoc - 1
Dim intTo AsInteger = intFrom + outLength - 1
For k AsInteger = intFrom To intTo
buildString &= strInput(k)
Next
EndSub

 
Old June 14th, 2006, 11:02 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

In this:
Code:
Sub MoveIt(ByVal inpStartLoc As Integer, _
           ByVal outLength   As Integer, _
           ByRef buildString As String)

    Dim intFrom As Integer = inpStartLoc - 1
    Dim intTo   As Integer = intFrom + outLength - 1

    For k As Integer = intFrom To intTo
        buildString &= strInput(k)
    Next

End Sub
I don't see any establishment for strInput?
Can you really create a variable in the statement with that construction
Code:
For k As Integer = . . .
I’ve never seen that before. If you cannot, then the reference to k would fail. If you can do that——[u]cool</u>!

BTW: (Just a tip) if you choose subject lines that point to the subject of the post, that would be better for you (attracting people who know something about the problem area). It is taken for granted that if you are posting a question you want some help...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Special Program Needed carlo0099 Pro PHP 0 March 16th, 2008 09:41 PM
Lottery Winners Program Urgent Help Needed! Honour C++ Programming 2 May 19th, 2007 04:47 AM
Help needed for Remote Installation Program inamhaq C# 0 September 24th, 2006 01:32 PM
Setup Project: Program not added in Start>Program arif_1947 VS.NET 2002/2003 2 March 31st, 2005 06:40 AM
Start a program inside another program Silje Classic ASP Professional 1 November 16th, 2004 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.