|
As the numbers picked in the 24 labels are unique, there can't be any number that matches more than one of the labels. Do you have more than one winning number to check for?
When checking numbers, don't loop through the labels to find the numbers. Keep the array of numbers from when you created the labels. To access the label associated with each number you can create an array of labels to store the reference to each label in.
To check for rows of mathcing numbers, you can use an array where you count the matching numbers in each row:
int[] rows = new int[4];
foreach (int winningNumber in winningNumbers) {
for (int i = 0; i < 24; i++) {
if (number[i] == winningNumber) {
rows[i / 6]++;
break;
}
}
}
for (int i = 0; i < 4; i++) {
if (rows[i] == 6) {
MessageBox.Show(String.Format("Row #{0} is full.", i + 1));
}
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi all!help needed..!!!
any idea about the source code for retrieving a song from the database by either humming the tune or giving voice commands as input..!!!
|
|
|
|
|
|
but how to differentiate between male and female voice..???
|
|
|
|
|
hi friends
how to convert string to arrays
for example "hello world" is given string
how to change it in single dimensional array
the quieter u become more u hear
|
|
|
|
|
Depends on the delimiter you want to use:
string.Split(' ');
modified 12-Sep-18 21:01pm.
|
|
|
|
|
string s = "hello world";
char[] c = s.ToCharArray();
gives an array of char. If you need an array of strings you can convert from that.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
thanks
the quieter u become more u hear
|
|
|
|
|
Hi,
if you don't actually need the array and just want to enumerate the characters in a string
(without changing them!) you can do:
string myString="Some string";
foreach (char myChar in myString) {
Console.WriteLine("myChar="+myChar);
}
PS: please read my signature, I changed it after reading your recent posts.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 12:03 PM
|
|
|
|
|
Luc Pattyn wrote:
PS: please read my signature, I changed it after reading your recent posts.
People like him don't care about such advice
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi, Can anyone help me with this code:
IHTMLDocument2 HTMLDocument = (IHTMLDocument2)axWebBrowser1.Document;
IHTMLElementCollection All_ = HTMLDocument.all;
IHTMLElement el_;
for (int r = 0; r < All_.length - 1; r++)
{
el_ = All_.item(r, 1) as IHTMLElement;
if (el_.isTextEdit)
{
listBox2.Items.Add("id = ");
}
else
{
listBox2.Items.Add("id = " + el_.id + " tagname = "+el_.tagName);
}
}
My problem is that el_id is empty. What am I doing wrong ?
The problem I try to solve is that my website is loading htmlcode from a database and has to send it to the browser. But before it is sent I need to check all the tag values (input type = text and select id = something and so on) and put some default value in it, so it is displayed in the clients browser. The problem is that I dont know what the html contains, it can contain any valid html code, that my app has to check and handle
Best Regards
FaroePigBear
|
|
|
|
|
Error found... no id tags was in the html, only name was specified
when changing:
<input type="text" name="date_from"
to:
<input type="text" id="date_from"
then the el_id contain date_from so it works now.
But however I have a new problem when setting the value of the tag.
If I run this:
element.setAttribute("value", "new value",0);
then it sets all value on my page. I guess it should be possible to write:
element.setAttribute("date_from", "new value",0);
.... but that does not work.
How can I set a value on only one text input tag´s id ?
Best Regards
FaroePigBear
|
|
|
|
|
if possible antbody help me... do no wat error it contains
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MainClass
{
public static void Main()
{
int tokenindex = 0;
int cntTokens = 0;
int iSymbol = -1;
int prevDictSymbol = -1;
char[] strToken = new char[512];
int i=0;
string[] arr = { "Hello", "World" };
while (arr[0] != null)
{
tokenindex = 0;
while ((arr[0] != ' ') && (arr[0] != ',') && (arr[0] != ';')
&& (arr[0] != '/') && (arr[0] != '#') && (arr[0] != '\0')
&& (arr[0] != '&') && (arr[0] != '-'))
strToken[tokenindex++] = arr[0];
arr++;
strToken[tokenindex] = '\0';
}
Console.WriteLine(" The Token is:", strToken);
Console.WriteLine("The Length of strToken", strToken);
}
}
the quieter u become more u hear
|
|
|
|
|
What sort of error? Compiler error? Not the data you excepted?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hmmm.. compiler error
the quieter u become more u hear
|
|
|
|
|
Okay, looks like you actually don't want help.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
his footer says
"
the quieter u become more u hear
"
he's absolutely right: don't give all the info too soon
<< Nearly all men can stand adversity, but if you want to test a man's character, give him power. >>
|
|
|
|
|
It's probably because all your code is in bold and not formatted correctly for review.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
If you can't see the problem, you really need to drop the C# class your taking right now. Intellisense lights that code up like a freakin' Christmas tree.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
BTW, this is the most frakked up homework assignment on the planet. Does your instructor really want you to use a character array to hold the extracted word?
I rewrote your code so that it would work, but I don't know if I want to give it to you because it has the very real possibility of helping you pass the course, and I don't think we need another clueless programmer running around writing crappy code.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Please nooo not another clueless programmer! there are enough in the world at the moment, can we put them all in one place and just push the barge away so they float away out of harms way.. preferablly with no internet connection
|
|
|
|
|
Well in amongst all the flames and elitist comments. I'll assume your a complete n00b and help you out a bit. but I gotta be honest, it was glaringly obvious.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MainClass
{
int tokenindex = 0;
int cntTokens = 0;
int iSymbol = -1;
int prevDictSymbol = -1;
char[] strToken = new char[512];
int i=0;
string[] arr = { "Hello", "World" };
public static void Main()
{
while ((arr[0] != null)&amp;(arr[0]!= ' ')&&(arr[0] != ',')&amp;(arr[0] != ';')&&(arr[0] != '/')&&(arr[0] != '#')&&(arr[0] != '\0')&&(arr[0] != '&')&&(arr[0] != '-'))
{
tokenindex = 0;
strToken[tokenindex++] = arr[0];
arr++;
strToken[tokenindex] = '\0';
}
Console.WriteLine(" The Token is:", strToken);
Console.WriteLine("The Length of strToken", strToken);
}
}
aaarghhh! too many ands. That's as much am I'm going to do, the rest is up to you.
<div class="ForumMod">modified on Monday, January 26, 2009 2:51 PM</div>
|
|
|
|
|
I am using crystal reports in my project. Every thing is fine but when i am trying to export report into any other format it gave me an error "LOAD FILE FAILED". Please help me how i can resolve this error.
I am using VS2008, Crystal Report 10 and sql2005
thanks
|
|
|
|
|
|