|
hi
you want to transfering date between froms. i think you familiar with Visual Basic 6.0 or Visual Basic.Net.
but currently you work in C#.
C# not like a Visual Basic.Net. it's too different.
Inheritance will help your problem.
so you imporve yours OOP concepts. then try it.
|
|
|
|
|
Hi again,
I found many solutions to my problem. However i would like (if possible) to use a 3º "object" to negociate between|with form1 and form2.
I d´ont like to code in both forms.cs, i would like to code in one class.cs to deal with both.
I thinking in store the variables values in a class.cs(other file).
---I want to code (part of) that process in a independent cs file
---write variable from form1 to class.cs file, and call variable from class.cs file to form2
I already solved it ... well found the solution... well just trying to get other solution more elegant!!!
Thank you!!!!
|
|
|
|
|
Hi there,
Where to put additional task in the setup project
In other word : where to put the code that add a file , or add a registry key ( I know how to do it but I do not know where!)
I hope I made it clear
Thanks in advance
There is always something to learn
|
|
|
|
|
How are you creating your setup project ? I know if you use a tool like Advanced Installer, you can do that stuff, but not sure how much of the msi functionality VS exposes ( I've never used VS to create an MSI )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What I wanted to do is:
to add some additional code to the setup , that perform some tasks during the installation of the application ,
I created the setup project as simple as possible , added from project template and then I added the primary output of the application
thanks
There is always something to learn
|
|
|
|
|
OK - I reiterate, I think the Visual Studio msis are a bit limited, try a tool like Advanced Installer.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have am reading from an external file and then converting that file into an array. The array is comma delimited, as seen here:
222,1.07181,0.933001
333,1.67566,0.596777
444,0.026708,37.4413
now, the first part of each line is a code, so that if the array was in any order, i could still find what i need. However, i want to turn this code into a string, because 222 doesn't mean anything to your average person. I have everything set up, but it wont compile because i cannot get my .ToString() or Convert.ToString() to work. Here is the code where I am receiving the error, help is much appreciated.
private void importRates()
{
string path = Settings.Default.FileName; //this["FileName"];
if (!File.Exists(path))
{
MessageBox.Show("no file found at " + path);
return;
}
int lineCount = 0;
StreamReader sr = new StreamReader(path);
{
String line;
while ((line = sr.ReadLine()) != null)
{
string[] ToFrom = line.Split(','); // this was originally double.Parse(ToFrom[0]);
rates[lineCount, 0] = ToFrom[0].ToString();
rates[lineCount, 1] = double.Parse(ToFrom[1]);
rates[lineCount, 2] = double.Parse(ToFrom[2]);
lineCount++;
}
sr.Close();
}
}
|
|
|
|
|
fixed. Had to add:
Dictionary<string, double[]> ratesDictionary = new Dictionary<string, double[]>();
and change my importRates to:
private void importRates()
{
string path = Settings.Default.FileName; //this["FileName"];
if (!File.Exists(path))
{
MessageBox.Show("no file found at " + path);
return;
}
int lineCount = 0;
StreamReader sr = new StreamReader(path);
{
String line;
while ((line = sr.ReadLine()) != null)
{
string[] ToFrom = line.Split(',');
ratesDictionary.Add(ToFrom[0].ToString(), new double[2]{double.Parse(ToFrom[1]), double.Parse(ToFrom[2])});
lineCount++;
}
sr.Close();
}
}
|
|
|
|
|
Today I found myself writing / reading binary image files, and I caught myself writing the following on a read:
using(fileReader = new BinaryReader(new FileStream(filePathName, FileMode.Open)))
{
}
Before I corrected my self, it got me thinking what exactly happens to anonymous instance members that are implementing the IDisposable interface? Would it be lost after the child instance is the finalized by sitting and waiting to be Garbage Collected? Or in the above example would the FileStream be picked up with the BinaryReader?
I do know that if you finalize the parent an instance is based off of, both get finalized... I know not as to what happens above???
This might even be a good article, if you could find it among the 1000's of hits on this topics keywords.
plz send teh codez?
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
This is interesting. I got the following when I looked BinaryReader class through reflector
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Stream stream = this.m_stream;
this.m_stream = null;
if (stream != null)
{
stream.Close();
}
}
this.m_stream = null;
this.m_buffer = null;
this.m_decoder = null;
this.m_charBytes = null;
this.m_singleChar = null;
this.m_charBuffer = null;
} Noticed the lines in bold ? it's closing the associated stream but not disposing. Also I noticed BinaryReader don't have a destructor. Any thoughts ?
|
|
|
|
|
This is odd, why does did MS even give it an IDisposable interface? Seams that streams don't need finalization and thusly just calling close is all you need.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Is there a way to the label the ticks in the TrackBar without creating separate label controls?
Beth
|
|
|
|
|
Only by writing your own class derived from progress bar and adding code to do that. So, labels are probably easiest
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi
how to generate foreach statement with CodeDom ?
thanks
|
|
|
|
|
Hi,
There is not direct way to use the For Each statement in CodeDom, however, you may try the following iteration technique to get the desired results.
IEnumerator e = dt.Rows.GetEnumerator();
while(e.MoveNext())
{
DataRow row = (DataRow)e.Current;
myList.Add(ConvertToObject(row));
}
You can generate a while loop using the CodeIterationStatement class, but not specify the InitStatement and IncrementStatement properties.
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
I have a Windows service in which I need to stop worker threads from my main thread. I am trying to use events to do this but I am stumped on why it is not working. Each class that runs a worker thread creates a stop event and a response event. When I need to stop the worker thread I call into the threads class and set the event. However, instead of the worker thread detecting that the event has been set and stopping gracefully, it just disappears. Why?
What is the best method for stopping a worker thread from the main thread?
|
|
|
|
|
Seeing some code might help.
Doesn't the event code execute in the calling thread? (I hadn't considered this until now.)
I've done similar things:
Calling the Thread's Abort method
Setting a semaphore that the thread checks
|
|
|
|
|
What do you do in your worker thread?
If you have something like a while(...) { do something }
then you can loop until a signal (e.g. a AutoResetEvent) is set by the main thread.
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|
<br />
void CFileChangeEvent::stopProcessThread()<br />
{<br />
TRACE( "> > > > CFileChangeEvent::stopProcessThread() entered - Event handles < %X, %X >, Event ID < %s >\n",<br />
m_hProcessStopEvent, m_hProcessRespEvent, getIdentifier() );<br />
<br />
::SetEvent( m_hProcessStopEvent );<br />
}<br />
<br />
UINT CFileChangeEvent::workerThread( LPVOID lpParam )<br />
{<br />
CFileChangeEvent* pEvent = (CFileChangeEvent*)lpParam;<br />
HANDLE hProcessStopEvent = pEvent->getProcessStopEvent();<br />
<br />
for( ; iterFile != vecFifFiles.end() && ! bCancelled;<br />
iterFile++ )<br />
{<br />
Do some work here<br />
<br />
<br />
DWORD dwWaitStatus = ::WaitForSingleObject( hProcessStopEvent, 1 ); <br />
if ( dwWaitStatus == WAIT_FAILED )<br />
{<br />
TRACE( "> > > > CFileChangeEvent::workerThread() - ::WaitForSingleObject() failed - Event handle < %X >\n",<br />
hProcessStopEvent );<br />
bCancelled = true;<br />
}<br />
else if ( dwWaitStatus == WAIT_OBJECT_0 )<br />
bCancelled = true;<br />
}<br />
}<br />
Thanks for your help.
|
|
|
|
|
RoyceF,
You seem to be in the wrong forum.
Regards,
Gareth.
|
|
|
|
|
Sorry, I thought I was in the C++/MFC forum.
|
|
|
|
|
I am wondering if the WaitForSingleObject() doesn't work if the event gets set before WaitForSingleObject() is called. It seems that it would just return the correct status of the event object.
|
|
|
|
|
I have re-posted this in the C++/MFC forum. I would move it if I could. Thanks.
|
|
|
|
|
Hi everyone,
I've been working on a windows mobile application that consists of a series of dynamically generated user forms and I was wondering if anyone knows how (following activation of the On-Screen Keyboard) I would get the currently selected form item to move up so it is above the OSK. Currently when the OSK is activated it obscures the active items and worse still completely obscures items at the bottom of the form. Its gotta be possible but I'm really stuck on how I would actually do it.
I'm pretty new to C# (<6mo) and especially to programming for mobile devices. Any help would be greatly appreciated. Hopefully the solution isn't staring me in the face
Cheers,
Drew
|
|
|
|
|
Drew,
You may try setting the Top property of the selected control to a value above the keyboard showing.
For example, in the code below, I am changing the top property of the checkbox which gets hidden when the input panel is enabled:
private void button1_Click(object sender, EventArgs e)
{
this.inputPanel1.Enabled = true;
}
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
if (inputPanel1.Enabled == true)
{
checkBox1.Top = inputPanel1.Bounds.Top - 50;
}
}
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|