abhi2011 Posted January 21, 2013 Author Share Posted January 21, 2013 So I am trying a very simple gaming client. Nothing much. I ripped the clsBuffer Class from EO and added it to the app. But now I have 2 problems not at all related to the ripping. (A bit cuz if I didn't rip it wouldn't have happened in the first place)1) Much of the functions Exit Functions statements are erroring with the msg that the function doesn't return anything. I have added the return statement at the end of the function just like in the original source.2) Then in another Function that returns an array, the tool says that Number of indices is less than the number of dimensions of the indexed array. ( I am Returning buffer())3) And also there seems that there is no vbUnicode so I used the following code```System.Text.Encoding.ASCII.Get[type]```I am not sure if it will work so plzz tell me if it will work and if not any other code suggestionsThanksAbhi2011 Link to comment Share on other sites More sharing options...
Mal Posted January 21, 2013 Share Posted January 21, 2013 http://msdn.microsoft.com/en-us/library/system.text.encoding.ascii.aspxUse that for help with Encoding. As far as some functions throwing a non-return error, make sure the return type matches the type of the function and that all code paths are returning a value (conditional statements may throw this if return is outside of their scope). I'd have to see the code for the array problem. Link to comment Share on other sites More sharing options...
abhi2011 Posted January 21, 2013 Author Share Posted January 21, 2013 Is it possible to not return anything? Cuz if I do return something there might be errors. (Not sure which all)Sure. (The code is the same as in VB) But here ya go```Public Function ToArray() As Byte() ToArray = Buffer() End Function``` Link to comment Share on other sites More sharing options...
Mal Posted January 21, 2013 Share Posted January 21, 2013 > Is it possible to not return anything? Cuz if I do return something there might be errors. (Not sure which all)> > Sure. (The code is the same as in VB) But here ya go> > ```> > Public Function ToArray() As Byte()> > ToArray = Buffer()> > End Function> > ```If you're not returning anything then you shouldn't be using a function. If you're assigning the value of the Buffer() to a property then use a method to set it. Link to comment Share on other sites More sharing options...
abhi2011 Posted January 21, 2013 Author Share Posted January 21, 2013 > If you're not returning anything then you shouldn't be using a function. If you're assigning the value of the Buffer() to a property then use a method to set it.I am returning something but there is a check and if it is false it just exits the function. As u told the return wasn't within the scope of the IfStatement so I have to put a return statement there also (the part which exits the function) Now the question is how do I return null byte arrays?EDIT: Never mind of return the null byte arrays. just found a better way (I think) return nothing. And I also wanted to ask does hitting a return statement make the program jump out of the function? (i.e exit it)EDIT2: Fixed almost all errors other than just 1``` Public Function ToString() As String Return StrConv(Buffer, vbunicode) End Function```This is the original code. vbUniCode is not defined so I used the System.Text.encoding.Ascii NameSpace but I can't find the function that is suitable for conversion of Bytes to a string format. Plzz advise. Link to comment Share on other sites More sharing options...
Mal Posted January 21, 2013 Share Posted January 21, 2013 > I am returning something but there is a check and if it is false it just exits the function. As u told the return wasn't within the scope of the IfStatement so I have to put a return statement there also (the part which exits the function) Now the question is how do I return null byte arrays?> > EDIT: Never mind of return the null byte arrays. just found a better way (I think) return nothing. And I also wanted to ask does hitting a return statement make the program jump out of the function? (i.e exit it)Yes, it does. If you return null or nothing then you're going to have to have to run a HasValue() (nullables have a property called HasValue; what it does is pretty implicit) check on whatever you're working with. Link to comment Share on other sites More sharing options...
abhi2011 Posted January 21, 2013 Author Share Posted January 21, 2013 Solved. Need to close. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now