|
You need an instance of FormA, like:
var forma = new FormA();
txtQtyB.Text = forma.panelA.txtQtaA.Text;
Or, more likely:
var forma = new FormA();
txtQtyB.Text = forma.txtQtaA.Text;
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
|
|
|
|
|
Or even more likely, he needs the existing instance of the form that the user entered data into...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
No.
This is a bad idea - it ties the two design of the two forms together and means they can't be modified without considering the impact of changes on the outside world.
The default setting is private for a reason, and changing it to public is a hack!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Changing the 'Ctor of a Form's access to 'Public is a mistake.
You need to set up a dynamic linkage between the run-time created TextBoxes in FormA and FormB. There are several ways you could do this, all relatively simple to implement. One example:
1. if FormB is a "Main Form" and creates the instance of FormA, you could have code in FormB create the TextBoxes at run-time and inject them into FormA: that way, FormB would have direct references to the TextBoxes.
To select from several other possible techniques, it would be helpful to know:
1. which is the "Main Form" here: A, B, or ? if A is not the Main Form where is the code that declares an instance of it and shows it ?
2. which is the Form in which the run-time TextBoxes in A are created: A ? or ?
3. do the number of TextBoxes created at run-time vary, or are they always the same number of TextBoxes ?
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
|
Hi all,
I have started a new WindowsForms project and I am wondering if there is a benefit to store my project data in a local SQLCE database or just store data table(s) in a xml file.
The data-tables have a maximum of 9999 records and 150 columns.
The data is used for auto-complete source(job number only) and to compare just one record from stored data with new data. the data does not change for hours.
The data per column is 10 characters.
I hope You can help me to choose and elaborate the pro's and cons.
Groover
0200 A9 23
0202 8D 01 80
0205 00
|
|
|
|
|
Any table with 150 columns means you have a bad design!
Having said that I would always go for a database solution but it may depend on your distribution requirements.
Managing data in an XML file is dramatically more difficult than read/write to a database. You have difficulty maintaining any sort of relational integrity and reporting is painful.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Mycroft,
Having a table with 150 columns is a must, the data just has 150 parameters that can change.
there is no need for reporting and no relations, just one or two tables, and distribution is to one workstation only.
Groover
0200 A9 23
0202 8D 01 80
0205 00
|
|
|
|
|
In general, it will take a bit more effort to get up and running with SqlCE than with XML files (IMO). There is also usually a need to distribute extra runtime dll's with SqlCE.
There is nothing in the description of your project that makes it obvious which is the better choice; and listing "pros and cons" that may have no bearing on your project seems pointless.
If there are no obvious advantages (apparent to you), then go with the one that performs best relative to your current needs.
|
|
|
|
|
Hi Gerry,
With the XML datafile I will have to store the datatable in memory and overwrite or create a new XML file with new or changed data.
Wit SQLCE database I will have to deal with one record only.
Groover
0200 A9 23
0202 8D 01 80
0205 00
|
|
|
|
|
Groover,
You have identified a requirement that is important then.
You are right: to "update" an Xml file, you will have to rewrite the entire file. If "updating" is a factor, then SqlCE is a better choice.
Having committed to SqlCE, I would then also look at Entity Framework (EF) for your ORM and EF's "Code First" approach where you have EF generate the database for you based on your class / entity definitions.
Gerry from Amersfoort.
|
|
|
|
|
Hi,
Everything is in the title, I have not found any library that allow myself to play a sound directly into the microphone.
If anyone has a solution, thank you.
|
|
|
|
|
..might not even be implemented in the device-driver. What makes you think one can play a sound through a recording-device?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I want develop an sound player.
When i speak from Skype (example) or other call apps, I want to listen sounds or music from my application
|
|
|
|
|
|
Thanks for your answer.
USB Microphone is an good idea.
I'll try to create it
|
|
|
|
|
You're welcome.
Emulators are great for demoing hardware dependent apps when it's not practical to haul everything around.
|
|
|
|
|
Ok, so I am at work but just couldn't wait to figure out what I am doing wrong so I am going to try to post this from my phone without my code in front of me.
I have a form and on the form I need the user to select a bit of data, so I am using showDialog (myPopup);
Then in the popup I have the user select said data from a list.
Then when they push the "confirm" button I do this in the on click method:
MainForm MF = new MainForm ();
MF.sendData (data);
this.Close();
Then back in MainForm in sendData() I want to be able to make a label that I have hidden: myHiddenLabel.Text = "data received";
However, this is where I hit a snag, it will not update the label?
Now when I tested and used a MessageBox.Show("test"); in the sendData() method it worked, but for some reason nothing on the MainForm will update for me?
Any ideas?
PLEASE NOTE: this was written off memory and on a phone so Gramm iCal errors and code that doesn't look gramma calluses correct is probably just a victim of autocorrect..
Sorry,
Thank you
|
|
|
|
|
|
My crystal ball is clouded-over, but, in general, you should not be creating a "new" MainForm ... if MainForm is the Form that used 'ShowDialog to put up the instance of your Data Form.
Every time you create a new MainForm with 'new ... .unless you have somehow kept a reference to the previous instance of MainForm ... you have discarded your reference: while that instance of the MainForm and any data the user entered on it, or state it maintains, is still there in memory, you have no way to access it.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
No.
As Bill says, you don't create a new instance, particularly if you want the data to go to the original main form.
Create a property in your popup:
public string Data { get; private set; } And set the value of Data in the button Click handler method. Make the button have a DialogResult value of OK, and the system will close the popup for you.
Then in your main form:
MyPopup mp = new MyPopup();
if (mp.ShowDialog() == DialogResult.OK)
{
string data = mp.Data;
...
} Will sort it all out for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
This was it exactly, Thank you to all that helped! problem solved!
Thank you guys!!!
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I want to get notified when my System.Windows.Forms.UserControl class is unselected. i.e. when another form is selected. I am using VisibleChanged to tell me when it is selected and that works. But it doesn't fire when the form is unselected. I have tried the following events:
ControlRemoved
Leave (Focus)
Does anyone know if there is an event for that?
|
|
|
|
|
You should be using the Activated event to tell when a specific form is brought forward and activated. That's the intended way to accomplish what you're trying to do.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|