RealOpty Posted May 27, 2005 Posted May 27, 2005 I get the error: System.NullReferenceException: Object reference not set to an instance of an object. at WindowsApplication2.Form1.decodes(String& strData, String& strFilename, Int32 lenData) at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\admin\My Documents\Visual Studio Projects\WindowsApplication2\Form1.vb:line 69 here is all of the code except the windows form code. Declare Function decodes Lib "./ladder.dll" Alias "decode" (ByVal strData As String, ByVal strFilename As String, ByVal lenData As Integer) As Integer Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim abc Dim ii As Integer abc = "12345" Try MsgBox(decodes(abc, "test.txt", Len(abc))) Catch err As Exception Me.RichTextBox1.Text = (err.ToString) End Try End Sub help :(? Quote
Administrators PlausiblyDamp Posted May 28, 2005 Administrators Posted May 28, 2005 Firstly I would recomend putting Option Strict On at the top of the file and fixing any problems it generates (e.g. what data type is abc supposed to be declared as?) Does the decode function always return a a value? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
RealOpty Posted May 28, 2005 Author Posted May 28, 2005 Firstly I would recomend putting Option Strict On at the top of the file and fixing any problems it generates (e.g. what data type is abc supposed to be declared as?) Does the decode function always return a a value? Thanks for the reply, been waiting on one all day :( I added that as you said. no new errors. and the ABC is nothing honestly, ive just been trying to debug this. and im not sure if it always does. Quote
thenerd Posted May 28, 2005 Posted May 28, 2005 He means that you are not dimming abc as anything in that code. You're leaving out the rest. You'll probably want to dim it as a string. Quote
Leaders snarfblam Posted May 28, 2005 Leaders Posted May 28, 2005 The error is being thrown in ladder.dll. What is ladder.dll? Is it managed? And what is decode supposed ot do? Its hard to figure out what is going wrong when we don't even know what is going on. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.