|
A foreach loop uses an enumerator. If you change the collection, the enumerator is invalidated, so you can't change the collection while you are looping it.
---
b { font-weight: normal; }
|
|
|
|
|
But if i try changing it outside the loop, it wont recognize the 'table' in the:
foreach (DataTable table in xmlFile.Tables)
Line.
Can you make a suggestion to make this work?
|
|
|
|
|
Yustme wrote: But if i try changing it outside the loop, it wont recognize the 'table' in the:
foreach (DataTable table in xmlFile.Tables)
Line.
What do you mean? What does removing an item have to do with the loop if you do it outside the loop?
Why are you using a loop anyway? You are removing the same table regardless of what table you are referencing in the loop.
---
b { font-weight: normal; }
|
|
|
|
|
This is outside the loop:
foreach (DataTable table in xmlFile.Tables)
{
some code....
}
mydataset.remove(table) <-- table does not exist in the current context.
Because its outside the loop.
Im using a loop to iterate through all tables. I think i have to remove it by index.
The names are all the same anyway.
|
|
|
|
|
Use a for or while loop, or store the references to the tables to be removed in a list.
---
b { font-weight: normal; }
|
|
|
|
|
Hi All. I must write an windows app where i must be able to send a message to a pager,E-mail and an SMS to a cell phone. I managed to get the e-mail working, but not such luck with the SMS or sending a messgae to a pager. I am not getting much help with the help files. Is there anyone that can perhaps help me?
Thanks
|
|
|
|
|
You'll need to find a Telecoms company which lets you send SMS or pager messages. Some Telco's offer such a service via a WebService, whilst others rely on other means.
Google hard enough, and you might find a free WebService, if not... be prepared to pay $$$$ for the privilige.
|
|
|
|
|
Hey...
I'm looking for an image comparison algorithm.
I have two same-sized images which I would like to compare, where speed is of the essence.
I have tried google, and articles in codeproject, but not much success...
Can anyone link me to an article, or a website where I can start learning?
Thanks,
Shy.
|
|
|
|
|
What kind of comparison? Exact? Then simple pixel by pixel comparison will do. Have a look at this[^] article series to find out how to do this fast.
|
|
|
|
|
Well... I'm looking for a quick way to compare two images.
I'm comparing the last screen capture to the current capture, in order to check for changes.
I guess it's kind'a like motion detection.
Robert Rohde wrote: Have a look at this[^] article series to find out how to do this fast.
I already read this article series... Well... Most of it
I also came across this[^]article showing how to detect motion, but the source code archive was corrupted, and he uses an AForge class which I couldn't figure what is doing, or where to find it.
Help...?
|
|
|
|
|
int var = 0;
int one = 1;
int six = 6;
hurt =+ one;
if (var = six)
label1.Text = "text..";
I am kinda new to this...
I want to make it so when you click on a button, var increses in value and when it finally reaches 6, to close the program. I know what I have is no where close to 'right' or even the easiest way, it's just easier for me to understand.
Thanks
Hengy
I like Pie
|
|
|
|
|
try
if(var == six)
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi
I need some help
I have a bit of code that i got from the tutorials on writing to text file.
Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt.
int id = int.Parse(textBox1.Text);
string name = textBox2.Text;
//create a new employee object
Employee mp = new Employee(id, name);
stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, mp);
stream.Close();
If someone could please help me out
|
|
|
|
|
|
I think that you are reading the wrong tutorial. That code is not writing a text file, it's serializing an object to a binary file.
Use the File.CreateText method to create a text file.
---
b { font-weight: normal; }
|
|
|
|
|
if you are just writing to a normal txt file just use normal File create operations.
string fname = "C:\\test.txt"
using(StreamWriter sw = File.CreateText(fname))
{
sw.WriteLine(data_to_be_written);
}
|
|
|
|
|
StreamWriter sw = new StreamWriter(@"c:\filename.txt",false);
sw.WriteLine((char)15); /// set char size while printing
sw.WriteLine("My name is: Jey");
sw.Close();
If u execute this code the text "My name is: Jey" inside the txt file. in "C Drive" and the file name "filename.txt"
Jey
|
|
|
|
|
In VS2005, whenever I write "using System.Windows.Forms.VisualStyles;" I get an error saying that 'VisualStyles' is not part of the 'System.Windows.Forms' namespace. Any ideas? Thanks.
|
|
|
|
|
|
I'm using VS2005 so I can only assume that 2.0 is enabled. I was wondering if this could be the issue. I know in the Eclipse you can pick which JRE you want to compile in. Is this an option somewhere in VS2005? Thanks again.
|
|
|
|
|
|
Yeah, "using System.Windows.Forms;" is right there at the top. This is confusing. Nobody seems to know what is going on. I tried a reinstall of the .net 2.0 framework as well as VS2005 itself. Thanks for your help so far, by the way.
|
|
|
|
|
In fact, nothing from 2.0 seems to be working! AutoScaleDimensions wont happen for me either. Well, I'm stuck.
|
|
|
|
|
Adding a reference to your project is not the same as writing a "using System.Windows.Forms;" statement at the top of your code file.
In your project, in Solution Explorer window, expand the "References" node. Is System.Windows.Forms listed there? If not, you'll need to add that reference.
Once you've done that, you should be able to type System.Windows.Forms.TextRenderer, which is a .NET 2.0 API. Do you see that class? If not, you're not using .NET 2.0. Make sure you're running Visual Studio 2005 and not 2003.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Oh, sorry. We got our wires crossed. Yes, it is included as a reference. I can't add TextRenderer. The only options I get under .Forms are ComponentModel, Design, and PropertyGridInternal. And yeah, I'm using VS2005. I don't own 2003.
Plus, I seem to be getting an error with "Application.EnableVisualStyles();". I thought this was only an issue in 1.1. Uh-ho.
|
|
|
|