Thankyou so very much. I can't believe I would screw up something like that! Man I must be getting old... Thankyou again, Tom
Vandretta
Posts
-
DataGridView to XLS/CSV -
DataGridView to XLS/CSVG'day all, I'm writing an application that requires me to output the values stored within a DataGridView to an cls/csv file (or basically anything that M$ Excel can read). This is as far as i have gotten:
string strValue = " "; for (int i = 0; i < stocksDataGridView.Rows.Count - 1; i++) { for (int j = 0; j < stocksDataGridView.Rows\[i\].Cells.Count; j++) { if (!string.IsNullOrEmpty(stocksDataGridView\[j, i\].Value.ToString())) { if (j > 0) strValue += "," + stocksDataGridView\[j, i\].Value.ToString(); else { if (!String.IsNullOrEmpty(strValue)) strValue = stocksDataGridView\[j, i\].Value.ToString(); else strValue = strValue + Environment.NewLine + stocksDataGridView\[j, i\].Value.ToString(); } } } strValue = strValue + Environment.NewLine; } string fileName = @saveFileDialog1.FileName; if (File.Exists(fileName) && !String.IsNullOrEmpty(strValue)) { File.WriteAllText(fileName, strValue); }
I'm sure its not very pretty and i have no idea how/where/why i have it in there, but all i can say is that it doesn't actually output anything. Any and all help will be greatly appreciated. Thanks in Advance, Tom
-
App.config or Resources.resxOk, Thankyou very much! I'll do that.
-
App.config or Resources.resxShould I use my app.config file or the Resources.resx in VS2008 to store the connection string for my DB? I am not sure which one would be better should I later on decide that I want to give the user the option to edit this.
-
Bubblesort AlgorithmYes I did thank you Simon. The step through debugger in VS took a little while to get used to but eventually it worked a treat. And i figured it out. So, as always, logic prevailed over the human condition.
-
Bubblesort AlgorithmThankyou for your help, simon. I suppose it does look like a homework problem ;P my apologies for making it so. But the only reason I asked this is the site where I got it from has it written in a similar way i was just trying to figure out why the program didnt work. Again my apologies.
-
Bubblesort AlgorithmHey all, I'm just trying to figure out why this bubble sort algorithm is ignoring the last element of the array.
namespace Bubble_sort
{
class SortArray
{
void BubblesortArray(int[] array)
{
int Position = 0;
int endpos = 0;
bool swapped = true;
while (swapped)
{
swapped = false;
Position = 0;
endpos = array.Length;
while (Position < endpos)
{
if (array[Position] > array[Position + 1])
{
int Temp = array[Position];
array[Position] = array[Position + 1];
array[Position + 1] = Temp;
swapped = true;
}
Position++;
endpos--;
}
for (int i = 0; i < array.Length; i++)
{
Console.Write(array[i].ToString() + ", ");
}
Console.WriteLine();
}
}public static void Main(string\[\] args) { SortArray Sort = new SortArray(); int\[\] a = {1, 2, 3, 4, 1, 45, 134, 762, 2}; Sort.BubblesortArray(a); for (int i = 0; i < a.Length; i++) { Console.Write(a\[i\].ToString() + ", "); } Console.Read(); } }
}
thats the code (its a console app). I do this out of curiosity, and annoyance( :-D ) but i would like any help you could offer me. Thankyou.
-
First programming language for high school students?You see, I don't believe that it should be about any one language as such. There are two main aspects to "Programming" 1) Programming (The Brain Stuff) -- This is the part where the student figures out an idea in a logical order. 2) Coding (The Easy/Automatic Stuff) -- Once you have an idea in your brain that is in a logical order you can then formulate it into instructions for the computer to understand(i.e. code). The simplest way of explaining this is the process of baking a cake. First one needs to figure out how to bake a cake and make choices about that cake(i.e chocolate, vanilla, etc.), this is the programming. Finally one needs to bake it, this is the coding. N.B In this example it does not matter whether the cake is conceived in French, Spanish, German, English, etc. You still end up with the same result - a cake. The same with programming, it doesn't matter if the language is C++, C#, VB.NET, Assembler, Delphi, FORTRAN or COBOL, etc. You still end up with a program that is the expression of the original idea, this allows the student an easier conversion between different methods of expression (different languages), thus nulling the need for any one specific language. So in essence, Coding is the expression of the idea that Programming provides. Therefore it is not important which language a student learns, only that they learn the correct idea structure behind the code. It also helps with alot of problem solving in life as well :-D.
-
Application.Exit();, Environment.Exit(0); or this.Close();Ok, thankyou guys.
-
Application.Exit();, Environment.Exit(0); or this.Close();I just wanted to know which one I should use. I have looked at the MSDN articles and have only found rigorous descriptions of each one but none of them give comparisons to the others. p.s. this is my first post, if I have done anything wrong please feel free to tell me. the code I have is:
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
GC.Collect();
Environment.Exit(0);//Or Application.Exit(); or this.Close(); I'm not sure
} -
Apple's new product [modified]Ahhhhhhhhh, right. Sounds like a typical mac shareholders convention to me.:rolleyes:
-
TOTDLOL, thats an insight into a webdevs life!
-
Windows Mobile, .Net and SmartphonesIn regards to the OS of your palm device, if your going to use it for developing .Net applications then defiantly The Qtek9100 with Windows Mobile 5.0 would be the go. I'm not sure exactly how badly the less powerful processor would hinder your applications performance but im sure it wouldnt be too drastic.
-
Bootcamp QuestionWell its a mac and the boot camp is written by apple, i dont see why you'd ever want to install it using a different bootloader if the original manufacturer has released a supported bootloader for you??
-
C# vs C++?Defiantly C++ for a games program, but if you want simplicity in converting the code from VB(ugh!) then C# is the way to go.:-D