|
jblouir wrote: so im just making a text adventure (In console)
Splendid! Splendid! Check out Collosal Cave Adventure[^] if you haven't already played it.
/ravi
|
|
|
|
|
Thanks for your help previously, been implementing it into my code.
Its changed a bit because I had problems with getting the .Count to work, doesnt appear to be in my namespaces.
but anyway heres what I have, the program doesnt get any syntax errors, but during the program running I get an error that...(scroll down)
#region dataload()
// Extracting the data from databin and dumping it in to an array.
static void dataload()
{
int intIndex = 0;
string strRoom = "anything";
string strDesc = "anything";
string strLook = "anything";
int intElement = 0;
int i = 0;
string[] lines = File.ReadAllLines("databin.txt");
foreach (string line in lines)
{
string[] elements = line.Split(new char[] { ',' });
intElement = elements.Length;
if (intElement > 0)
{
int n;
if (int.TryParse(elements[0], out n))
{
// the first element was a number, now stored in n
intIndex = n;
}
}
if (intElement > 1)
{
strRoom = elements[1];
}
if (intElement > 2)
{
strDesc = elements[2];
}
if (intElement > 3)
{
strLook = elements[3];
}
RoomData descriptor = new RoomData(intIndex, strRoom, strDesc, strLook);
GlobalVars.ArrRoomData.SetValue(descriptor,i);
i = i++;
// etc.
}
}
#endregion
the error points to GlobalVars.ArrRoomData.SetValue(descriptor,i); saying that the object reference not set to an instance of an object
ArrRoomData is declared in a class called GlobalVars (Global Variables), where...
private static object[] arrRoomData;
public object[] ArrRoomData
{
get { return arrRoomData; }
set { arrRoomData = value; }
}
I have a feeling that once it gets past this error im going to get another one on the fact that its going to try and declare another object named descriptor, which im guessing I can I can do an if check on a boolean to see if its already been declared once.
|
|
|
|
|
It's perhaps intElement.Length
jblouir wrote: string strRoom = "anything";
string strDesc = "anything";
string strLook = "anything";
This is outside your loop, so if a row fails, instead of a default, it will continue to contain the last value found.
jblouir wrote: saying that the object reference not set to an instance of an object
Odds are that a line doesn't have enough elements, and removing Count is making a check that is just invalid.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
At the bottom of the code where the particular code of line is highlighted.
descriptor is holding the correct values for index, room name, room desc, and room look.
The .Count I got around by using .Length which returns the number of elements in that line which logically to me does the same thing.
|
|
|
|
|
I Want to make the background and the tracker with images I've got.
There any dll that I can add my WinForm Controls ?
Thank alot.
|
|
|
|
|
I suspect you'd need to make the control owner drawn. I am certain there are examples of this here on code project.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have discovered the existence of IKVM.NET for the interoperability between java and .NET. I have tried to convert java libraries in DLL and to call them from C#... all ok. Is it possible, with IKVM, to call java libraries runtime without converting them in DLL?
|
|
|
|
|
No. Why do you think IKVM exists?
|
|
|
|
|
Askalo wrote: Is it possible, with IKVM, to call java libraries runtime without converting them in DLL?
AFAIK you have to convert them to a DLL file to use it in .net.
You can write a webservice in java to expose the methods and the .net application can communicate via the webservice to the application.
|
|
|
|
|
How i can use USB gates on C#.Net?
There are any ActiveX for this?
Thanks
P.S. I use Windows Vista
By Windows M
|
|
|
|
|
Windows M wrote: How i can use USB gates on C#.Net?
What's a "USB gate"?
|
|
|
|
|
Is a "Universal Serial Bus" device
Excuse me for error but i'm a italian boy.
By Windows M
|
|
|
|
|
Windows M wrote: Is a "Universal Serial Bus" device
I know what USB is. What's a USB "gate"???
|
|
|
|
|
Hi all.
What are the limitations of the Express Editions of C# etc?
And are other compilers just as good as microsoft's?
I've been tinkering around with C# (my first attempt at programming) for a
while now and i seem to be able to do everything with the Express edition(EE).
Would a buisness legally be able to use the EE to create custom software? Or
would i be able to create apps that i could sell with the EE?
Thanks.
|
|
|
|
|
Visual Studio .NET 2005 Feature comparison chart[^]
Ylno wrote: And are other compilers just as good as microsoft's?
There are others, but I haven't heard of anyone using them.
Ylno wrote: Would a buisness legally be able to use the EE to create custom software? Or would i be able to create apps that i could sell with the EE?
You could, but it's not recommended. You only get a single deployment solution, ClickOnce, which is not very flexible for commerical software.
You'd need an external installer editor to create application deployments that give you much greater flexibility over your installations.
If you really want to get into commercial software, use at least the Professional versions of Visual Studio.
|
|
|
|
|
The limitations tend to revolve around things like database connection tools. You can write any DB code you like, but you don't get the same tools to do it with.
Ylno wrote: And are other compilers just as good as microsoft's?
Microsoft's C++ compiler is very good, nowadays. The question makes no sense in any other context, I don't believe there's a bunch of viable contenders for C# and VB.NET compilers, although I believe one or two exist, when MS defines the language, they will always be the best, by definition.
Ylno wrote: Would a buisness legally be able to use the EE to create custom software? Or
would i be able to create apps that i could sell with the EE?
Surprisingly, I believe the answer is 'yes'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Thanks all.
I really should have looked at the FAQ !
|
|
|
|
|
hello,
I want to deselect a row in the datagridview, and I'm using the code:
<br />
if ( dgv[ hti.ColumnIndex, hti.RowIndex ].Selected )<br />
{<br />
dgv[ hti.ColumnIndex, hti.RowIndex ].Selected = false;<br />
}<br />
else<br />
{<br />
dgv[ hti.ColumnIndex, hti.RowIndex ].Selected = true;<br />
}<br />
this code is in the DatagridView_MouseClick.
the code does not work, anybody knows why?
thank you
|
|
|
|
|
First of all you could have written this like this:
<br />
dgv[ hti.ColumnIndex, hti.RowIndex ].Selected=!(dgv[ hti.ColumnIndex, hti.RowIndex ].Selected);<br />
Secondly, if the row is not selected it will become selected. Do you want this to happen?
|
|
|
|
|
You can use ClearSelection function of DataGridView
|
|
|
|
|
Hi,
this also works
dgv[ hti.ColumnIndex, hti.RowIndex ].SelectedIndex = -1
rAm
i Think, i Wait, i Fast -- Siddartha
|
|
|
|
|
the "SelectedIndex" does not exist in this case.
|
|
|
|
|
how can i activate a function when a user pressed a button while the program that should do this work is hidden:
if i'm working in microsoft word office, how can i follow every pressed button?
|
|
|
|
|
This smells like malware. The first think you'll need to do is to convince us that you've got a legitimate reason behind this requirement.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|