If it is difficult, then is there a portable compiler that I can use?
Nathan Revka
Posts
-
How do you compile code from notepad? -
How do you sort a listBox by number value rather than alphabeticallyI am storing card displays (eg J♣) in a list box through a list <KeyValuePair<string, int> and I want to order the cards numerically from greatest value to smallest value in the list box. When I change the sorting property on the properties box to "descending", the list is sorted inverse-alphabetically (ie Q is at top and 10 is at the bottom). I want to sort the list descending numerically, by value, so that A is at the top and 2 is at the bottom. How can I do this?
-
How do you sort a listBox by number value rather than alphabeticallyI am storing card displays (eg J♣) in a list box through a list and I want to order the cards numerically from greatest value to smallest value in the list box. When I change the sorting property on the properties box to "descending", the list is sorted inverse-alphabetically (ie Q is at top and 10 is at the bottom). I want to sort the list descending numerically, by value, so that A is at the top and 2 is at the bottom. How can I do this?
-
How can I use System.IO to do these 3 things [modified]I have not yet manipulated text files so I need some help performing the following tasks: 1. I need to access a letter in a name (eg the 'h' in John) 2. I also need to find the name's position in a list of names (eg Joey is in position 3 here: John, Sally, Joey, Paul) 3. Finally I need to find the length (number of letters) of a name (eg the lenth of Paul is 4) I am not limited to System.IO, but I am assuming that is the namespace that should be used for these tasks, so if one of these tasks require something not is System.IO then please tell me. Edit: The names are in "name1", "name2", "name3" format in the textfile. This might make things easier. Edit 2: Never mind I already got it. The trick is to store the file as a string and use the methods in the IEnumerator class.
modified on Tuesday, August 4, 2009 12:53 AM
-
What is an instance variable and how do you declare one?Wait a minute, aren't you creating a class and not a variable?
-
What is an instance variable and how do you declare one?I need to create the private instance variable savingsBalance, which includes the amount the saver has on deposit, and the saver's first and last name.
-
What the heck does this mean? [modified]This might just be poor wording on part of the writer, but what does this mean: "Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver has on deposit along with the account holder's first and last names." Is the private instance variable this:
static private object savingsBalance = firstName + " " + lastName + "has $" + amount;
And what does "each object of the class" mean? Isn't every single keyword an object? Edit: He wants me to calculate stuff with savingsBalance but I do not think I am able to do that with an object that includes a string with a word like "has"
modified on Sunday, August 2, 2009 5:44 PM
-
windows form programmingI am trying to access a listbox in a class that is not Form1.cs but I am having difficulty. How do I access this list box? I have tried:
public class DeckManagement: Form
and
public class DeckManagement: WarGame
//WarGame is the name of the class inside form1 -
How do you store a bunch of values in a 20x20 arrayYes. Thanks :)
-
How do you store a bunch of values in a 20x20 arrayI have
int[,] Grid = new int[20,20];
but I do not know how to effieciently store each value. I do not want to create a single dimensional array--it will be difficult to use in my program--and I do not want to store each value one by one. Here are the values I want in my array: 08, 02, 22, 97, 38, 15, 00, 40 ,00, 75, 04, 05, 07 ,78 ,52, 12, 50, 77, 91, 08, 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40 ,98, 43, 69, 48, 04, 56, 62, 00, 81, 49, 31, 73, 55, 79 ,14 ,29 ,93, 71, 40, 67, 53, 88, 30, 03, 49, 13, 36, 65, 52, 70, 95, 23, 04, 60, 11, 42, 69, 24, 68, 56, 01, 32, 56, 71, 37, 02, 36, 91, 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80, 24, 47, 32, 60, 99, 03, 45, 02, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50, 32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70, 67, 26, 20, 68, 02, 62, 12, 20, 95, 63, 94, 39, 63, 08, 40, 91, 66, 49, 94, 21, 24, 55, 58, 05, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72, 21, 36, 23, 09, 75, 00, 76, 44, 20, 45, 35, 14, 00, 61, 33, 97, 34, 31, 33, 95, 78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 03, 80, 04, 62, 16, 14 ,09 ,53, 56, 92, 16, 39, 05, 42, 96, 35, 31, 47 ,55 ,58 ,88, 24, 00, 17, 54, 24, 36, 29, 85, 57, 86, 56, 00, 48, 35, 71, 89, 07, 05, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58, 19, 80, 81, 68, 05, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 04, 89, 55, 40, 04, 52, 08, 83, 97, 35, 99, 16, 07, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66, 88, 36, 68, 87, 57, 62, 20, 72, 03, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69, 04, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 08, 46, 29, 32, 40, 62, 76, 36, 20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 04, 36, 16, 20, 73, 35, 29, 78, 31, 90, 01, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 05, 54, 01, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 01, 89, 19, 67, 48,
-
How do you create 2 random values [modified]I wrote
Random RollOne = new Random(); Random RollTwo = new Random(); dieOne = RollOne.Next(1, 7); dieTwo = RollTwo.Next(1 , 7); sum = dieOne + dieTwo;
but dieOne and dieTwo are always equal, how do you make two independent random values? Edit: Thanks Mikanu, it works now.
modified on Monday, July 13, 2009 10:43 PM
-
How do you count the number of decimals in a decimal datatypeI have program that will input an amount of money so I do not want the user to input something like $2.684. I need to be able to count the number of decimals so I can create an if statement that prevents the user from inputting such a number.
-
Help me to convert this code in Java into a C# codeWhy do you need to convert it? Just make it a method and use it, C#.NET allows you to mix languages.
-
How to increase the scope in an if statement [modified]I need to increase the scope of double fee and total. The following code doesn't work because fee and total are out of the scope on the writeline.
if (time <= 3)
{
fee = 2;
total = total + fee;
}I have more if statements involving fee and total but they all will be applied to the following writeline
Console.WriteLine("Current charge: {0:c}, Total receipts: {1:c}", fee, total);
Edit: I made fee and total a static variable above the main method and now it works even though I set the new value of fee and total inside a block with less scope. I am not sure how this works, but it works, maybe someone can tell me why it works.
modified on Saturday, July 11, 2009 7:11 PM