|
Maybe look at a public method on form2 as your entry point from form1, in that public method you use as the entry point use a ref variable that will enable you to use the variable in form2 and what ever you changed it to in form2 it will return that value back to form1.
He who laughs last is a bit on the slow side
|
|
|
|
|
1. For the first task, you can capture any suitable event of the
DataGridView in which you can get the content of the selected cell like
CellClick etc
2. To pass back the data to MainForm
There are many ways to do it. I choose the simplest one.
Create public properties in Second form and while closing this form, set the values of those properties with the selected values.
3. To get the data passed from form2
When the form2 closes, read the public properties created in step2
|
|
|
|
|
Just have the MultiplesFound form expose a public property indicating the row that was selected by the user.
<br />
if (ds.Tables[0].Rows.Count > 0)<br />
{<br />
int SelectedRow = 0;<br />
if (ds.Tables[0].Rows.Count > 1)<br />
{<br />
cardNumber = txtCardNumber.Text;<br />
MultiplesFound myMF = new MultiplesFound(cardNumber);<br />
myMF.myCardNumber = cardNumber;<br />
myMF.ShowDialog();<br />
SelectedRow = myMF.SelectedRow;<br />
}<br />
txtProductCode.DataBindings.Add("text", ds.Tables[SelectedRow], "prod_code");<br />
txtDescription.DataBindings.Add("text", ds.Tables[SelectedRow], "prod_desc");<br />
txtModelNumber.DataBindings.Add("text", ds.Tables[SelectedRow], "model_no");<br />
<br />
}<br />
Jeff Clark
Systems Architect
JP Clark, INC.
Columbus, Ohio
|
|
|
|
|
i getting this error message in my project
Control 'ctl00_cphContent_ctl00_grdReport' of type 'GridView' must be placed inside a form tag with runat=server.
Pls help me
kankeyan
|
|
|
|
|
What part of that don't you understand? Also, if you don't post your code, how are we supposed to tell you how to correct it?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
protected void Page_PreRender(Object o, EventArgs e)
{
if (IsPostBack.Equals(false))
{
calFrom.SelectedDate = System.DateTime.Today;
calTo.SelectedDate = System.DateTime.Today;
}
}
protected void calFrom_SelectionChanged(object sender, EventArgs e)
{
blnCallFrom = true;
}
protected void calTo_SelectionChanged(object sender, EventArgs e)
{
blnCallTo = true;
}
protected void btnExcel_Click(object sender, EventArgs e)
{
// Set the content type to Excel
Response.ContentType = "application/vnd.ms-excel";
//Turn off the view state
this.EnableViewState = false;
//Remove the charset from the Content-Type header
Response.Charset = String.Empty;
Response.AddHeader("content-disposition", "attachment; filename=" + calFrom.SelectedDate.ToString("YYYYMMdd") + ".xls");
value is not posted in the calfrom date too
System.IO.StringWriter myTextWriter =new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter myHtmlTextWriter = new System.Web.UI.HtmlTextWriter(myTextWriter);
grdReport.RenderControl(myHtmlTextWriter);
error is coming here
//grdReport.RenderControl(myHtmlTextWriter);
//Write the HTML to the browser
Response.Write(myTextWriter.ToString());
//End the response
Response.End();
}
}
kankeyan
|
|
|
|
|
The problem is with the ASPX, not the CS file. Do what the compiler suggests, and if you stil face problems, post the relevant ASPX code. In the right forum.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
First This is an asp.net question so you should have posted it in the correct forum.
And regarding the error it states that the gridview control has to be inside the form control which should have runat=server attributes.
Apurva Kaushal
|
|
|
|
|
how to delete a string from a string array.
|
|
|
|
|
Have a look at String.Replace method but remember that it will delete all occurrences from the string
|
|
|
|
|
you want to diminsish the size of the array or put a null or "" instead?
|
|
|
|
|
Hello,
I would suggest to use the System.Collections.Specialized.StringCollection class instead.
All the best,
Martin
|
|
|
|
|
You can also use StringBuilder. It depends how many times you will use it
|
|
|
|
|
Hello,
I wouldn't prevere the StringBuilder as an alternative to a string[].
I would miss methods like Contains.
Allt he best,
Martin
|
|
|
|
|
hello,
Thanks my problem solved
|
|
|
|
|
|
You can't easily. You'd have to copy the array to a second array leaving out the string you don't want.
Just use List<string> instead.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
I am trying to learn C# for a few months. I have managed writing my own classes and developped a few little .NET applications. My Pc has .NET FrameWork of ver: 2.0 .
Recently I have a need to create a new project (In Visual Studio - 2005) for some kind of small devices that runs Windows CE and have Compact FrameWork. In Visual Studio 2005 I do this steps "File\New\Project" and choose "Visual C# \ Smart Device" and <pocket pc="" 2006=""> Or <widnows ce="" 5.0=""> as project type, and choose <device application=""> .. Just to new a project for mobile devices.
Unfortunately creating fails with this message ("This Project requires .NET Compact FrameWork v2.0, whics is not installed on this machine"). And also I tried Device Application(1.0) but the result is an error. Althoug I use C#, just to test I tried this in Vb.net but I failed creating a new Device App. project.
What does it mean ? Should I install Compact FW 2.0 on my PC, which seems strange to me ?
And I also should mention that while I was intalling Visual Studio-2005 with a Custom Instalation in which I only not choosen the J# components. I am sure that I selected all other compnents (Vb.net, C#, Web programming Tools, Device porgramming Capabilities.. things like that )
Thanks for all in advance.
|
|
|
|
|
Hi all,
Anybody could assist me. how to resize two dimensional array. Actually I have chunk the first row in matrix. like I have Matrix[2][4]. I have chunk
Matrix[0][0...3] and I want to redeclare Matrix like[1][4] dynamically. if u have any way. Please help me out.
Sapan Roy
Thanks to All
|
|
|
|
|
Hello,
Look at this question from
27 June 2007[^]
All the best,
Martin
|
|
|
|
|
hi,
any idea on how to run a c# application on solaris machine?
it can be webservice or windows application....
|
|
|
|
|
plz check-out mono...
Mono (OpenSource .NET implementation for multiplatform )
http://www.mono-project.com/Main_Page
hope, it helps..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
cool83 wrote: to run a c# application on solaris machine
You need .NET Runtime CLR. For Solaris, there should be a distribution from Mono.
|
|
|
|
|
hi i am currently trying to read/write data to an ms 2007 excel.
i already have some past experiance doing this with vb6 however i need to do it using vs.net 2005 c# console application now.
and the past code that i used be4 dont work can anyone recommand something?
|
|
|
|
|