Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to add numbers to the total value of an int cell instead of set its value? Correctly I'm using a list and I and things are getting weird.. the list is <int> list and its value is jumping into random numbers without any reason. I think that changing the count type (from list into int) will solve it. (c#. visual studio 2013).
Doesn't look so hard to me...?
int variable = 10; // start with 10 points
variable++; // add 1
variable += 3 // add 3
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am creating a POS system using windows forms for a school project and would like to be able to add decimals together using the code in a button and come up with a total as the output at the end... any ideas on how this can be done?
If following doesn't answer your questions, please edit your post by elaborating your question.
Two questions I get so far.
Add a decimal to an undetermined length array.
Generally using List in C# if data keeps growing.
// Put this as your member variable
List<decimal> m_ItemPriceInOrder = new List<decimal>;
// In your button event
decimal price = ... // Get your price of item
m_ItemPriceInOrder.Add( price );
To sum up cost of items when checkout.
Using foreach to iterate through every item in your list.
Also a simple for loop is okay, but foreach represents "iterating through every item".
decimal sum = 0;
foreach( var item in m_ItemPriceInOrder ){
sum+=item;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
How to order numbers stored as string in db by OrderBy function
mytable.OrderBy(s => s.Year);
for ex =>
string Year= 2013/2014
string Year= 2017/2018
You can use the following to take the first year only:
s.Year.Trim().Substring(0, 4)
If the values are in a character column then they will sort as characters, not as numbers.
The only real workaround I know of would be to
Either change that column to numeric data type, which you can't do if
the values are '2013/2014'
Create another numeric column that stores the numbers (i.e. 2013,
2017) and then sort on that column.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Will the C# function Convert.ToInt32(text) convert different words to the same int? Any links or pushes in the right direction are appreciated!
P.S.
What about anagrams?
No, Convert.ToInt32(text) will just try to parse your text to an int, like:
Convert.ToInt32("032") will return 32 as int but
Convert.ToInt32("Brian") will throw an exception.
I assume that you want to have some kind of hashing, when you say "different words to the same int".
Try GetHashCode(). It will return the same value if you call it multiple times with the same value, for example:
"Brian".GetHashCode() will always return 1635321435
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How Can I Assign Multiple Values To Where It Says uint i need to to be from 0 to 18 because im doing something client based a it needs to be done for all 18 clients at once
RPC.doTypeWriter((uint) 0 , (int)numericUpDown21.Value, metroTextBox22.Text, (short)numericUpDown23.Value, (double)numericUpDown24.Value, (float)numericUpDown25.Value, (float)numericUpDown26.Value, (ushort)numericUpDown35.Value, (ushort)numericUpDown36.Value, (ushort)numericUpDown37.Value, (int)numericUpDown27.Value, (int)numericUpDown28.Value, (int)numericUpDown29.Value, (int)numericUpDown30.Value, (int)numericUpDown31.Value, (int)numericUpDown32.Value, (int)numericUpDown33.Value, (int)numericUpDown34.Value);
You can't. An uint is a single integer value, it can't hold multiple values.
Use a loop to loop from 0 to 17 (as that is 18 clients):
for (uint i = 0; i < 18; i++) {
RPC.doTypeWriter(i, (int)numericUpDown21.Value, metroTextBox22.Text, (short)numericUpDown23.Value, (double)numericUpDown24.Value, (float)numericUpDown25.Value, (float)numericUpDown26.Value, (ushort)numericUpDown35.Value, (ushort)numericUpDown36.Value, (ushort)numericUpDown37.Value, (int)numericUpDown27.Value, (int)numericUpDown28.Value, (int)numericUpDown29.Value, (int)numericUpDown30.Value, (int)numericUpDown31.Value, (int)numericUpDown32.Value, (int)numericUpDown33.Value, (int)numericUpDown34.Value);
}
The naming suggests that you are doing RPC calls to the clients, so you might need to move more code into the loop, e.g. doing the connection to each client in the loop.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How do i create a six digit sequence number in c# ?
Is there any other way than storing a string in the database like "000000" and later on incrementing it through the last inserted value ?
Use a plain old number as a sequence, this is what your DB will provide. If you want to display it with six digits, just call: yourNumber.ToString("D6")
(see docs)