|
Pass it in the constructor, or via public properties. If form2 is not a child of form1, pass it using a delegate.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I Have a function that takes arguments and process and return a dataset (the scenario is working fine), Now i need to put my function in thread but unable to find any way to pass arguments to thread and take return argument from thread.
Totally clueless to threads,
Please Help!!!!
Thank you!
M. Nauman Yousuf
"Mess with the Best, Die like the rest"
|
|
|
|
|
Hi,
have a look at the BackgroundWorker class, that is intended for such situations.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I will look in to it, thx Luc Pattyn
"Mess with the Best, Die like the rest"
|
|
|
|
|
if you are using framework 2 then i think there is some thing called parametrize thread. if you are using frame work 1.1 then have a function in a different class which doesnt take any parameter but use class level variabe in that class pass the parameter through constructor and and in the method use those mvariable. and call that method using thread.
|
|
|
|
|
I want to load data from sql server table to a datagridview using threading and I want to display the loading progress in progressbar. Please help.
Kutty
|
|
|
|
|
Hi,
typically loading data from a database is a single, atomic, operation, which gets launched,
executes, and returns when done; the client simply waits while the server is
gathering the requested data. So progress information is simply not available.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I found a solution during my googling. But it is not working in my case, can any body please check this code.
this what I found:
public partial class Form1 : Form
{
public static string ConnectionString = "" //your connection string here
DataSet DS = new DataSet();
double TotalRows =0;
double RowIndex = 1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection DBConn = new OleDbConnection(ConnectionString);
OleDbDataAdapter DBAdapter = new OleDbDataAdapter();
DBAdapter.SelectCommand = new OleDbCommand("SELECT Count(*) from tblPersons", DBConn);
DBConn.Open();
TotalRows = (int)DBAdapter.SelectCommand.ExecuteScalar(); //retrieve the nr. of rows in the DB Table
DBConn.Close();
DBAdapter.SelectCommand.CommandText = "SELECT * from tblPersons";
DS.Tables.Add(new DataTable("Customers"));
// Add event handler to the row changing event in the dataset
DS.Tables["Customers"].RowChanging += new DataRowChangeEventHandler(Form1_RowChanging);
DBAdapter.Fill(DS, "Customers");
dataGridView1.DataSource = DS.Tables[0];
}
void Form1_RowChanging(object sender, DataRowChangeEventArgs e)
{
if (e.Action.ToString() == "Add") //check if the action is 'Add' (not 'Commit')
{
Thread.Sleep(500);
progressBar1.Value = (int)Math.Round((double)(RowIndex / TotalRows) * 100); //update the progressbar
progressBar1.Refresh();
RowIndex++; //count rows
}
}
}
}
Kutty
|
|
|
|
|
Hi All
I wount set the type of column in DataGridView to combobox how i can do that
and I wount to set his DataSourc to Specifyic Table How i can do that
thanks for any body help me
Thaer
|
|
|
|
|
Hi - nobody helped you 5 hours ago as your question is poorly formed, doesn't make sense and doesn't tell anybody what you have actually tried already to solve your problem.
Posting the same question again is NOT going to make sometbody suddenly thing - "oh darn, I didn't answer Thaer's question - I better do it now."
Form you questions in a clear, concise way, state exactly what the problem is what 'what you have tried to solve it' and you watch the difference.....you will not have to post it twice either. People here WANT to help - but will only help those that want to help themselves, and not those that just want their work doing for them.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
i have a setup project setup1 which deploys two windows services windows
service1,windows service2.i also added some custom installation actions into
it using projectinstaller.cs.In windowsservice1 oninstall event,i attached a
database ;(create database for attach command) .
in windowsservice2 onuninstall event,i deletes the databse using "drop
database";
the setup exe installs the windows services successfully.but when i
uninstall them, the drop database does not work as sql server places a lock
on mdf files.(cant drop database as mdf file is in use).how can i solve this
problem. Also since uninstall operation is not transactional, only the
windowsservice1 gets uninstalled. when i again try to uninstall ,it shows
"the specified service does not exist as an i nstalled service"(probably the
setup again tries to unstall the already uninstalled windowsservice1).
How can i solve these problems?
i need a way to unlock the mdf files before executing drop database
command
And in unstall event of windows service 1, i need a way to check if it is
already uninstalled
public override void UnInstall()
{
how to check whether the service already uninstalled()?;
base.Uninstall();
}
|
|
|
|
|
Are you sure dropping the database is such a good idea??
What say you just want to upgrade the service??
Ta
Paul
Help, Urgent, Need answers Urgent, Quick Help arggggghhhhhhhhhh
|
|
|
|
|
No.The uninstall operation ,I mean,completely delete the application including db and registry entries .I could not uninstall the application yet.Is there atleast a way to debug the custom install actions?
|
|
|
|
|
I thought you were using an install shield with custom actions, the install shield will worry about all that for you!
Ta
Paul
Help, Urgent, Need answers Urgent, Quick Help arggggghhhhhhhhhh
|
|
|
|
|
Hi, I want to place my windows form 10 pixels from the right side of my user's screen.
But they have different screen resolutions, so i cant place it with a value in pixels.
So do anyone know how to do it?
I'm using this code on my form-load, to place the window:
<br />
this.Height = 175;<br />
this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);<br />
Thanks,
Elias Sorensen
|
|
|
|
|
<br />
int distanceFromRight=10;<br />
int distanceFromBottom=10;<br />
<br />
int screenWidth=Screen.PrimaryScreen.WorkingArea.Width;<br />
int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;<br />
<br />
this.Left = screenWidth - this.Width - distanceFromRight;<br />
this.Top=screenHeight-this.Height-distanceFromBottom;<br />
<br />
or you can use
<br />
<br />
int x = screenWidth - this.Width - distanceFromRight;<br />
int y= screenHeight-this.Height-distanceFromBottom;<br />
<br />
this.SetBounds(x,y,this.Width,this.Height);<br />
<br />
|
|
|
|
|
Hi,
your code is placing the window at the bottom end of the screen, but flush left
since you specified zero for X.
you could replace that zero by an expression that is basically the same as you did
for Y, substituting widths for heights of course.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks to all. It works perfect now
|
|
|
|
|
Hi Everyone
i've a problem using System.Security.Cryptography.RSACryptoServiceProvider class
when i work with this we must pass the RSA Crytographic parameteres to an object of the RSAParameters class
but they are in the form of Modulus, P, Q, Exponent & ...
we fill the RSAParameteres with these and pass it to the RSACryptoServiceProvider
but i have Public key and Private key from a certificate file, and i haven't Modulus, P, Q, Exponent & ...
i want to know how can i encrypt and decrypt string directly with Public & Private key not with Modulus, P, Q, Exponent & ...
thanx all.
|
|
|
|
|
Asymmetric keys can be created using ToXmlString() method
and can be retrieved using FromXmlString method
it can be done like this:
<br />
AsymmetricAlgorithm asym=AsymmetricAlgorithm.Create();<br />
string myCode=asym.ToXmlString(true);
<br />
RSACryptoServiceProvider rsa=new RSACryptoServiceProvider();<br />
rsa.FromXmlSring(myCode);<br />
<br />
<br />
and if you want the parameters you can use ExportParameters
and of course for converting it to xmlKey you can use ToXmlString again.
if you want get only the key (modulus) part before it you can create the complete key using a little xml operations or filling RSAParameters and importing it using ImportParameters method.
hope the post would be useful
good luck
|
|
|
|
|
So, what you said is completely true in the way of using generated randomly parameters, but id don't want to use them, I have Public Key & Private Key only, and I want to create parameters from them (and not randomly) and then using the parameters to encrypt and decrypt
Nagan ina bisavadan
|
|
|
|
|
|
Thank you so much, i use them and give you my resault
Hessam jan vaghean mamnunam
|
|
|
|
|
Hi All
I wount set the type of column in DataGridView to combobox how i can do that
and wount to set the DataSourc to Specifyic Table How i can do that
thanks for any body help me
Thaer
|
|
|
|
|
I use the RegAsm.exe to registration the C# Dll but when i try to do CoCreateInstance i don't know where to find the IID of the C# DLL.
Someone can help me please ?
Thanks.
|
|
|
|