d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Just Need A Little > C#
Add Reply New Topic New Poll
Member
Posts: 11,011
Joined: Oct 12 2008
Gold: Locked
Trader: Scammer
Warn: 50%
Jul 30 2013 09:31pm
No one is active there, so I will post here


No that isnt real info



This post was edited by Pat_Man on Jul 30 2013 09:32pm
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Jul 30 2013 09:56pm
You havent really explained your problem, but from the looks of it.. You're probably wondering why it's writing 01234567 instead of what you've typed in?

This post was edited by SelfTaught on Jul 30 2013 09:56pm
Member
Posts: 11,011
Joined: Oct 12 2008
Gold: Locked
Trader: Scammer
Warn: 50%
Jul 30 2013 09:57pm
Quote (SelfTaught @ 30 Jul 2013 22:56)
You havent really explained your problem, but from the looks of it.. You're probably wondering why it's writing 01234567 instead of what you've typed in?


Yes, I was going to have to capture the new data and either append or overwrite it on the file.
Yet I have no idea how to do this, because im a complete nobsauce.
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Jul 30 2013 10:27pm
Quote (Pat_Man @ Jul 30 2013 07:57pm)
Yes, I was going to have to capture the new data and either append or overwrite it on the file.
Yet I have no idea how to do this, because im a complete nobsauce.


I don't really know C# all that well, so I probably can't help you out as much as some of the guys here can.

However.. I can tell you that it's writing 01234567 because you've setup a loop that iterates 8 times and writes the loops current iteration. And it's putting it on a the next row down because you've also appended a tab character to the file 8x as well.

Like you said, you'll need to capture the new data you typed in, and then write that.

How'd you go about capturing the data, I don't know. There should be a member function for the field object, like getText(), that will return the text you typed in.

Once you've managed to capture the field text, you'll be able to write that to the file.

Here's a link that explains how to write to files: http://msdn.microsoft.com/en-us/library/vstudio/8bh11f1k.aspx

Here's some sloppy pseudo code, but I think it gets the point across.

Code
button1_click()
{
open file("//path//to//file");

text = field.getText();

file.write(text);

file.close();
}


Hopefully that makes sense...


Member
Posts: 11,011
Joined: Oct 12 2008
Gold: Locked
Trader: Scammer
Warn: 50%
Jul 30 2013 10:36pm
Quote (SelfTaught @ 30 Jul 2013 23:27)
I don't really know C# all that well, so I probably can't help you out as much as some of the guys here can.

However.. I can tell you that it's writing 01234567 because you've setup a loop that iterates 8 times and writes the loops current iteration. And it's putting it on a the next row down because you've also appended a tab character to the file 8x as well.

Like you said, you'll need to capture the new data you typed in, and then write that.

How'd you go about capturing the data, I don't know. There should be a member function for the field object, like getText(), that will return the text you typed in.

Once you've managed to capture the field text, you'll be able to write that to the file.

Here's a link that explains how to write to files: http://msdn.microsoft.com/en-us/library/vstudio/8bh11f1k.aspx

Here's some sloppy pseudo code, but I think it gets the point across.

Code
button1_click()
{
open file("//path//to//file");

text = field.getText();

file.write(text);

file.close();
}


Hopefully that makes sense...


When I pull up the program, the datagridview is preloaded with a .csv file thats in the debug folder.
So im not sure that "getText" would work

Maybe I could trying something like UpdateRowSource?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 30 2013 10:37pm
he assumes getText() is for a textbox where user inputs stuff. not that i care enough to help you meet a deadline when you just started the night before.

This post was edited by carteblanche on Jul 30 2013 10:38pm
Member
Posts: 11,011
Joined: Oct 12 2008
Gold: Locked
Trader: Scammer
Warn: 50%
Jul 30 2013 10:39pm
Quote (carteblanche @ 30 Jul 2013 23:37)
he assumes getText() is for a textbox where user inputs stuff. not that i care enough to help you meet a deadline when you just started the night before.


Im a complete newguy to this, I started 3 nights ago.
I didnt volunteer to do this, my brother just dropped it on me.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll