|
sorry to be so lame with this question, but i'm still learning how this works.
how can i get the input from a user in a textbox control on one form to display on another form?
private void data()<br />
{<br />
Mainform.sdgform sdg = new Mainform.sdgform();<br />
MessageBox.Show(sdg.txtShipTo.Text);<br />
}<br />
<br />
public System.Windows.Forms.TextBox txtShipTo;<br />
public void textboxexample()
{<br />
this.txtShipTo.Text = "example data";<br />
}
I have a whole form with a lot of textboxes that a user fills in and i need this data to write to a text file. the problem for me is that the toolbar button (on form 1) generates the 'write to textfile' code but it doesn't see the users input (from form 2). i know it's a lame-o question, but i'm still very new.
Thanks for your help.
|
|
|
|
|
One way would be to make your textboxes public, that way the other form can "see" it.
|
|
|
|
|
Hello all,
I'm having a bit of trouble with decimal.Parse. I am trying to convert a currency string into a decimal number. This is my code...
decimal theValue = decimal.Parse(strValue, NumberStyles.Currency);
This works fine for string values such as "£1.23" or "$4.56", but throws an invalid input exception if i try it with "€9.87".
I'm using VS.NET 2002 (1.0 framework), does anyone know if this works with euro's in 2003 (1.1)?? If so then i'll upgrade to that, if not has anyone got a workaround?
Thanks in advance,
Simon.
|
|
|
|
|
Simon_uk wrote:
I'm using VS.NET 2002 (1.0 framework), does anyone know if this works with euro's in 2003 (1.1)??
If anyone cares, then this is still a problem in the 1.1 framework so you have to deal with Euro's manually.
Simon.
|
|
|
|
|
Simon_uk wrote:
If anyone cares, then this is still a problem in the 1.1 framework so you have to deal with Euro's manually.
I care very much, what is the exact problem? Some sort of bug or...
I'm about to port (re-write actually) a 400,000+ lines of code c++ program to c# that will definitely be parsing user entry of Euro values (not to mention pesos, kroners etc etc).
|
|
|
|
|
hi,
does anyone know how to change the standardprinter in a .net application?
thanks
michael
ps:
my concret problem is that i use the acrobat pdf-control to display a pfd in my application. ich even can print it with the "printAll()" methode on the standardprinter. but i found no way to set the printer the document should be printed. i even would be thankfull for a tipp to change the sprinter-settings in the pfd-control ;o)
|
|
|
|
|
Hi folks,
I´m building a database application, which has to connect to a database through an ODBC provider, but when I insert an OleDbDataAdapter in my form, and try to "connect" it with any ODBC data source, I get a nasty message telling me that the data source and the adapter are not compatible.
If I choose another OleDB provider, such as Microsoft Jet driver it works fine.
The question is: ¿do I need any kind of special code/libraries to get data from ODBC sources?.
Thanks in advance.
|
|
|
|
|
What does your ConnectionString look like? Can you also post what excatly the error message says?
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
The ConnectionString of my connection is:
"Provider=MSDASQL.1;Persist Security Info=False;Data Source=Base de datos de ejemplo Xtreme;Extended Properties="DSN=Base de datos de ejemplo Xtreme;DBQ=C:\Archivos de programa\Microsoft Visual Studio .NET\Crystal Reports\Samples\Database\es\xtreme;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;";Initial Catalog=C:\Archivos de programa\Microsoft Visual Studio .NET\Crystal Reports\Samples\Database\es\xtreme"
And I get this error message:
"La conexión que acaba de crear no funciona con el adaptador actual"
In english:
"The connection you´ve just created doesn´t work with the current adapter"
Maybe I need some patch or update for my VS copy.
"When I look into your eyes, there´s nothing there to see, nothing but my own mistakes staring back at me"
|
|
|
|
|
If you're using Framework 1.0 and VS.NET 2002, you'll need to download the ODBC.NET Data Provider[^].
If you're using Framework 1.1 and VS.NET 2003, then you just need to use the System.Data.Odbc namespace.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Here's part of my project:
public class NetworkStats
{
private Form1 form;
private AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer player;
private ConfigResult cf;
public NetworkStats(Form1 form1, AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer player1, ConfigResult cf1)
{
form = form1;
player = player1;
cf = cf1;
}
public FileStruct FileStats()
{
string path;
DirectoryInfo dir;
FileStruct fs = new FileStruct();
path = cf.pathLog + "\\" + player.currentMedia.name + "\\";
dir = new DirectoryInfo(cf.pathLog);
dir.CreateSubdirectory(player.currentMedia.name);
if(cf.buffCount)
{
try
{
fs.fileStats = new FileStream(path + "Stats.txt", FileMode.Create, FileAccess.Write);
fs.swStats = new StreamWriter(fs.fileStats);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
if(cf.currBW)
{
try
{
fs.fileBW = new FileStream(path + "currBW.txt", FileMode.Create, FileAccess.Write);
fs.swBW = new StreamWriter(fs.fileBW);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
if(cf.currBR)
{
try
{
fs.fileBR = new FileStream(path + "currBR.txt", FileMode.Create, FileAccess.Write);
fs.swBR = new StreamWriter(fs.fileBR);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
if(cf.currFR)
{
try
{
fs.fileFR = new FileStream(path + "currFR.txt", FileMode.Create, FileAccess.Write);
fs.swFR = new StreamWriter(fs.fileFR);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
return fs;
}
public void initStats()
{
FileStruct fs;
fs = FileStats();
while (Form1.videoParat != true)
{
try
{
form.BitRate.Text = (player.network.bitRate).ToString() + " Bps";
if(cf.currBR)
{
fs.swBR.WriteLine(player.network.bitRate.ToString() + " " + player.controls.currentPositionString);
}
form.BW.Text = (player.network.bandWidth).ToString() + " Bps";
if(cf.currBW)
{
fs.swBW.WriteLine(player.network.bandWidth.ToString() + " " + player.controls.currentPositionString);
}
form.buffCount.Text = (player.network.bufferingCount).ToString();
form.buffProgress.Text = (player.network.bufferingProgress).ToString();
form.buffTime.Text = (player.network.bufferingTime).ToString() + " mseg";
form.downProgress.Text = (player.network.downloadProgress).ToString() + " %";
form.currentFR.Text = (player.network.frameRate).ToString() + " FPS";
if(cf.currFR)
{
fs.swFR.WriteLine(player.network.frameRate.ToString() + " " + player.controls.currentPositionString);
}
form.encodFR.Text = (player.network.encodedFrameRate).ToString() + " FPS";
form.framesSkip.Text = (player.network.framesSkipped).ToString();
form.lostPackets.Text = (player.network.lostPackets).ToString();
form.rxQuality.Text = (player.network.receptionQuality).ToString();
form.sourceProtocol.Text = (player.network.sourceProtocol);
form.rxPackets.Text = (player.network.receivedPackets).ToString();
form.recoveredPackets.Text = (player.network.recoveredPackets).ToString();
form.maxBW.Text = (player.network.maxBandwidth).ToString() + " Bps";
fs.swStats.WriteLine("prova");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
//escriure la resta d'estadístiques
try
{
fs.swStats.WriteLine("prova 2"); <--------
fs.swBR.WriteLine("prova");
fs.swStats.WriteLine("prova 3");
fs.swBW.WriteLine("prova");
fs.swStats.WriteLine("Buffering Count: ");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
Console.WriteLine(e.Message);
}
fs.Close();
}
}
public class FileStruct
{
public FileStream fileBW;
public StreamWriter swBW;
public FileStream fileBR;
public StreamWriter swBR;
public FileStream fileFR;
public StreamWriter swFR;
public FileStream fileStats;
public StreamWriter swStats;
public void Close()
{
try
{
swBW.Close();
swBR.Close();
swFR.Close();
swStats.Close();
fileBW.Close();
fileBR.Close();
fileFR.Close();
fileStats.Close();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
The problem is that when arrives to "fs.swStats.WriteLine("prova 2");" it gets the "object reference..." exception, and I can't write anything to the output file....I really don't know what to do!!!
Please, if anyone has any idea, I'd be really grateful!!!! 
|
|
|
|
|
Well, I would guess that, since you only create the swStats member when cf.buffCount is true, cf.buffCount is false.
Your best bet is to use the debugger to trace through your application. Check that swStats is being created properly, and if it is what else is happening as your app runs.
Also, I would define a new class that encapsulates the "create a filestream, create a stream writer" code. You're replicating it several times.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
Thank you very much!! I think I've found the problem, although is not about cf.buffCount. You're right, I'll encapsulate this function into another class, thank you very much! 
|
|
|
|
|
As title,
I am a C++ programmer so dont need a book that is too much geared for new programmers.
Are there any other books I should look at ?
I want to make use of the 50% off on this title at amazon.co.uk if it is any good
|
|
|
|
|
|
That link seems to point to "Help: Object reference not set to an instance of an object"
If it was meant to point to "Looking for a good book on C#", then I really want to know about C# Unleashed as it is enjoying a 50% off offer
|
|
|
|
|
Ooooops,sorry I don't know why the link does not work correctlly.there is another thread like your question 8 question below yours.Check it,I don't know why the link does not work.
Mazy
No sig. available now.
|
|
|
|
|
How can I add a type derived from DataGridColumnStyle into the list in the DataGridColumnStyle Collection Editor dialog box (of the Properties dialog box)?
|
|
|
|
|
I have a contextmenu which I use & for charachter to set shortcut for users. Foe example it has a "&Hello" test.The problem is an underline is shown in design mode under 'H' , but at run time it does not appear.The event habdler fires when I press H but there is no underlinw at run time.Any idea?
Mazy
No sig. available now.
|
|
|
|
|
You might have Windows' setting turned on where it doesn't show the accelerator letters unless you press Alt. An easy way to tell is to put a MainMenu on your form and do the same thing. If at runtime you don't see the accelerator letters then you know this is the case. Press Alt to bring up the menu and then they'll be there.
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Oh ya.When I press Alt they apear. Where is this setting in windows?
Mazy
No sig. available now.
|
|
|
|
|
On WinXP Pro it's located under Display Properties, Appearance tab, Effects... button, uncheck "Hide underlined letters for keyboard navigation until I press the Alt key".
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Thanks James.
Mazy
No sig. available now.
|
|
|
|
|
Scenario:
Typed Tables Earnings, Projects, Adresses, Einheiten
DataSets: EarnSet (Earnings, Projects, Einheiten), ProjectSet(Projects)
For one Programm I need the Tables Earnings and Projects in one DataSet. For another Programm I need just the Table Projects. The Status is that now I have two DataSets: EarnSet with Earnings and Projects Tables and ProjectSet with only the Projects Table. So I have the same table-Definition in two different DataSets.
Is there a way to add the typed Table Projects from ProjectSet to the typed DataSet EarnSet so that after in the EarnSet the typed! Table Projects exists?
Stefan
|
|
|
|
|
1. I think it's impossible to have one table into two datasets
2. Try to use one dataset or copy table with data
Hi,
AW
|
|
|
|