|
YawgmothIII wrote:
Now that I understand what the compiler is saying is wrong i was able to make that error go away.. though i don't fully understand why...lol.
Appearently all i needed was:
- SpriteSet[(int)Sprite.BlueBlob] = new classSprite();
but i thought it already did that when I did this:
- private classSprite[] SpriteSet = new classSprite[2];
So if anyone could explain that to me, it would be greatly appreciated.
The new problem is:
- Value does not fall within the expected range
when i try to do this:
TempSurface = new Surface(SpriteSet[(int)Sprite.BlueBlob].FilePath, description, display);
Hi - welcome to CP !!
private classSprite[] SpriteSet = new classSprite[2]; creates an array of two classSprites.
SpriteSet[(int)Sprite.BlueBlob] = new classSprite(); this assumes SpriteSet exists as an array already, and assigns the classSprite at the position Sprite.BlueBlob ( which must be 0 or 1 ) to be a new classSprite. This is obviously a class of your own design, is there some reason why you'd need to do both, that is, why you'd need to call the constructor for every item in the array ?
"Value does not fall within the expected range"
At a guess, this means that SpriteSet does not contain enough values for there to be one at Sprite.BlueBlob.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
This is obviously a class of your own design, is there some reason why you'd need to do both, that is, why you'd need to call the constructor for every item in the array ?
If I understand you correctly, then no i don't believe there is a reason, but that just happens to be the way i figured out how to make "Object reference not set to an instance of an object" go away. I didn't think i would have to do both either, but if i don't "Object reference not set to an instance of an object" pops up on everyone of the classes..uh..objects?.
And about the second problem, i have taken the (int)Sprite.BlueBlob out and replaced it with a ZERO like it should be, but it does the same thing. "Value does not fall within the expected range" when i try to create a surface.
...help..me...
|
|
|
|
|
Anonymous wrote:
And about the second problem, i have taken the (int)Sprite.BlueBlob out and replaced it with a ZERO like it should be, but it does the same thing. "Value does not fall within the expected range" when i try to create a surface.
Then it must be something wrong with the data being passed in to the method. Look at the parameters you're passing in to the constructor, and then read MSDN to see what the valid ranges of values are that you can pass in.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I FINALLY figured it out.
When i entered this:
SpriteSet[(int)Sprite.BlueBlob].SpriteSurface = new Surface(SpriteSet[(int)Sprite.BlueBlob].FilePath, description, display);<br />
SpriteSet[(int)Sprite.BlueBlob].FilePath was equal to Application.StartupPath + "\\Blob_Sequence.bmp"
Unfortuantely Blob_Sequence.bmp is not the name of my file.. its BlueBlob_Sequence.bmp.
I never would have guessed that, that would give me that kind of error.
thanks for your help!
ugh.. my brain hurts...but in a good way... i think?
|
|
|
|
|
Yeah, that's a totally dumb error to return. Why not 'file does not exist' ?
Anonymous wrote:
thanks for your help!
Dunno if I helped, but I was happy to try
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hey everybody!
I wondered if it is possible to use windows' auto-complete.
I don't mind if it'll be using web application or not.
we all know the option of "remember my password" in mail accounts and many other places, and the listbox that opens under textbox with old texts that the user entered.
is there a way to use that database in c# win application or c# web application?
if there is can someone help me with that (tutorial, or somekind of explanation).
Thanks Alot!!!
|
|
|
|
|
|
Thanks aLOT !!!
just one more question, do you know any other tutorial for web apps?
Thanks!
|
|
|
|
|
Good afternoon:
Have you ever used SMS
Systems Management Server?
If you have then you know you can connect to another PC and interact with the Desktop.
I would like to know how this is done and are there any good articles?
I have looked under Video Buffer, Video Stream but just cant find what I am looking for.
Thank you very much,
William O'Malley
|
|
|
|
|
|
Tried using ContextMenu and ToolBar controls, utilizing ownerdrawn = true to render a matrix of shape icons in-place-of the owner drawn MenuItem.
The problem is there is no way to correlate the mouse click coords to that of item selected in the ownerdrawn MenuItem.
Looking for some sample code in which someone has attempted to create an MS Word AutoShape "like" control.
Thanks
|
|
|
|
|
Hi all,
I am trying to connect to an ACCESS database and read data from it. I believe the connection opens and closes fine, but when I add the line to Read from the data (ExecuteReader) I get the following exception error:
[An unhandled exception of type 'Microsoft.Data.Odbc.OdbcException' occurred in microsoft.data.odbc.dll]
I also downloaded and installed the latest MDAC and the ODBC driver (unless there is other stuff to be installed I am not aware of!)
And it is not an SQL-command error because (and this is also interesting) when I copy the table to my C: drive, everything works fine and I get the results I am looking for, even though it is pointing to the I: drive (the local server where the data is stored)
////////////here is the code:
string connection= "Driver={Microsoft Access Driver (*.mdb)};"
+ "Dbq=I:\\ACCESS2000\\US_MASPS.mdb;" ;
OdbcConnection myConnection = new OdbcConnection(connection);
myConnection2.Open();
string select = "SELECT * from US_MASPS.TBLGMS"
+" WHERE SeqNo = 12";
OdbcCommand aCommand = new OdbcCommand(select, myConnection);
OdbcDataReader aReader = aCommand.ExecuteReader();
/////////////
Thanks in advance
|
|
|
|
|
I would recommend moving from a DBQ connection string to the following:
Standard security:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"
Workgroup (system database):
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:System Database=system.mdw;"
With password:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"
Also check out www.connectionstrings.com
|
|
|
|
|
Thanks for the reply. I know that website! It is where I got the connection string from.
But I found the solution.. simply, the path must be added to SQL statment!!!
Thanks for the hint though!
|
|
|
|
|
I need to develop a client-based component (similar to activex, but using .NET) that can be used in web pages just like an activex control can. Is this possible? I have done several searches but can't seem to find exactly what I'm looking for. Thank you.
|
|
|
|
|
Process p = new Process();
p.StartInfo.FileName = "wordpad.exe";
p.StartInfo.Arguments = @"C:\My Dir\My file.txt";
p.Start();
Wordpad launches successfully then I get the error message that "Cannot find file C:\My". So it looks like my path is being treated as 3 separate arguments (space delimited). How do I specify an argument that has spaces in the path or file name?
|
|
|
|
|
It's easy:
Process p = new Process();
p.StartInfo.FileName = "wordpad.exe";
p.StartInfo.Arguments = @"""C:\My Dir\My file.txt""";
p.Start();
|
|
|
|
|
If command line arguments contain spaces, they need to be wrapped within doublequotes. So
p.StartInfo.Arguments = @"""C:\My Dir\My file.txt""";
will work.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Is class wizard(view) disabled in the Beta? I can't get it work.
We ysterday got drunk with Bacchus ...
|
|
|
|
|
Hi friends,
In VS 2005 a new partial type is introduced. Have you know how we can identify a type is partial or not by using reflection in c#. Please help..........
Regards,
Rathish P S
|
|
|
|
|
I thought partial types was a compilation thing only? The compiler patches together all partial types with the same name and generates one single IL class, I think.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I'm trying to use TypeConverters on a a property which is an Array of specific objects.
It works well converting to a string, but fails to convert back to the obejct.
I have tried setting up my own Typeconverter but its methods are never called.
Any ideas on what I need to do to get this working.
Thanks,
Chris
|
|
|
|
|
Is there any Win API that i can use to open a file in its corresponding application by duble clickin on its icon?
how to associate open with option with the file icon?
|
|
|
|
|
cool:in C# you can do
System.Diagnostics.Process.Start(openFileDialog1.FileName);
not sure if it answers your question fully but that's my .02....
:->
|
|
|
|
|
You don't need API to do that.
If the file and the application in the machine, you just need this:
<br />
System.Diagnostics.Process p=new System.Diagnostics.Process();<br />
p.StartInfo.FileName="C:\\a.jpg";<br />
p.Start(); <br />
<br />
I hope that's you need to.
|
|
|
|