|
In .net 2005
This is a windows application
I have adapted the following code in order to populate the datagridview from xml file
DataSet ds = new DataSet();<br />
ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
dataGridView1.DataSource = ds.Tables[0];
While the datagrid is clicked then it mead=ns the user is tring to edit the record so that i can get the selected row and the selected rows first cell contains the primary key so i am passing that to the form 2 (edit form) as follows in that the constructor of the form 2 takes one string argument which is the primary key of the selected field passed from the form1 as follwos
In form 1
private void dataGridView1_DoubleClick(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("" + dataGridView1.CurrentCellAddress.Y);<br />
MessageBox.Show(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
Form2 f = new Form2(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
f.val = dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString();<br />
f.Show();<br />
}
In form 2
public Form2(string value1)<br />
{<br />
InitializeComponent();<br />
textBox1.Text = value1;<br />
DataSet ds = new DataSet();<br />
ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns[0] };<br />
DataRow dr = ds.Tables[0].Rows.Find(textBox1.Text);<br />
textBox2.Text =Convert.ToString( dr[1]);<br />
<br />
}<br />
if the Datarow and DataSet object is global and if you give the following code it will be deleted.
<br />
dr.delete();<br />
ds.WriteXML(...)<br />
Please tell me whether this is working or not but keeping a linklabel inside a datagrid is not possible if it is a web application then you can do that by keeing the hyper link field in the gridview control and it is possible to hide the primary key also
-- modified at 5:43 Monday 11th June, 2007
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Hi all,
I'm new to WPF and I'm trying to create a sheet music renderer. In order to be able to lay out notes on lines and in between lines, I am using grids to put my notes in rows and columns.
To acheive this, I would like to be able to have two grids with one superimposed on the other (this is easy to do). However, I would like to be able to position one grid to always be offset from the other grid by half the height of a row of the other grid (all rows are equally sized). I can achieve this somewhat by using a RenderTransform for a given scale, however the alignment changes when grid dynamically resizes to fit its container or when I scale transform the grid. The same goes by setting the margin. Instead I would like to somehow databind the y-offset of the one grid to half of the row height property of the other grid, but I can't figure out how to do so. This offset could be set by using a top margin or a render transform, but it must be dynamically calculated based on the current row height *0.5 of the other grid.
Any help or ideas would be much appreciated!
Thanks,
Tian
|
|
|
|
|
hi, I am using the C#.net 2.0 (2005)
what should i use for display the data...DatagridView or DataGrid...?
Please Help and also send the reason
Regards
Pankaj Joshi
|
|
|
|
|
DataGridView is easier to maintain but you cant format it in a good way.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
try MS-FlexGrid
|
|
|
|
|
Hi,
hard to say without knowing your requirements. Generally I would go for the DataGridView. Its a bit easier to use. Customization capabilities are nearly equal in both grids.
If you want to show a DataSet with different tables and relations between them than you should use the DataGrid.
Robert
|
|
|
|
|
The reason that many options exist is that different ones are better suited to different situations. Use the most lightweight object that lets you achieve your goal.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hello All,
I have a desktop application which have the a MDI from and some childs forms.
when i cleck on MDI's menu one form is open like
Form1 frm=new Form1();
frm.show();
this is OK. But whenever user again click onto the menu again a form is displayed
I know this is because of
Form1 frm=new Form1();
But i want to show form only once i.e. If form open then no need to show it else show...
how I can do this..?
Regards
Pankaj Joshi
|
|
|
|
|
Hi,
there are many ways to do this, e.g. keeping a counter (or boolean flag).
The preferred one however is by simply disabling the menu item so the user sees he will
not be able to do it again.
|
|
|
|
|
Thx For Your Reply ,
I tried what you said ... but unable to got success because of the following regions.
1. Public Variables are not allowed in C#.
2. Every thing is object oriented that means you have to decalare a new instance of class variable before use it.
Say I have one MDI and two childs forms when I click on the menu and form1 is shows I use a class say class1
which public variable i assign as true say
public bool isForm1Shows=false;
When I use this in MDI I have to make a object of class1 to use isForm1Shows when I done this
isForm1Shows automatically goes false and creates problem. say after displaying the form1 i assign
this like
form1 frm= new form1();
isForm1Shows=true;
frm.show;
Then its ok but when i close the form1 what happned..? i have to write code on disposing method of the
form1 and again if i want to use Class1 here I have to create an object by keyword NEW then
isForm1Shows automatically goes to false. and this creates problem to me.
I think You got what i want to say
please Help me....
Regards
Pankaj Joshi
|
|
|
|
|
Hi,
your isForm1Shows should not be an instance (=non-static) member of Form1.
Make it either:
- an instance member of the class that creates the forms (your app itself?);
- a static member of the Form1 class (so it is shared by all Form1 instances,
and can be accessed even before the first Form1 instance exists).
You set it to true when you dco the frm.Show(); that is OK. Now you must set
it to false again when the form gets closed; this requires using one of
the events, e.g. the Closed event.
I dont see why you mention disposing the form; you can achieve what you want
without it...
If you are unfamiliar with static, public, Closed event, I strongly recommend
you buy a book on C# and work your way through it...
Good luck.
|
|
|
|
|
I assume it's not modal. In this case, it should be a member variable regardless, and you can check if it's visible before showing it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Sir Sir Sir,
how i can check it is visible or not for checking visibility I have to create an
instance of that. And whenever I create New instance it create a new form
Please help
Regards
Pankaj Joshi
|
|
|
|
|
Hi, why not loop through the child forms. What i do is set the form to max, but you could check for your form.name or whatever property you would like to juse
Form[] charr= this.MdiChildren; <br />
<br />
foreach (Form chform in charr) <br />
chform.WindowState=FormWindowState.Maximized;
Kind regards,
marcel vreuls
http://www.marcelvreuls.com
|
|
|
|
|
Thx For Reply,
But i can't get this method yet..
and what about the forms which have maximize propety false please
give me a simple solution.
Regards
Pankaj Joshi
|
|
|
|
|
Is it possible to see from web whether or not the EXE is installed on a
machine? for example, i'd like to check if gtalk or realoneplayer is installed in localmachine and if it is not installed ,how can find from web.at that time i want to give alert message or give the downloaded page.Is it is possible bc..Plz any one help me.
Thanks.
Regards,
justin
|
|
|
|
|
Yes.
You might consider attempting to read the default value from the
registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App
Paths\realoneplayer.exe.
Hope this will help you.
ANd you can alert the Message using Javascript.
Regards,
Satips.
|
|
|
|
|
Thanks for ur reply..
I cant able to read the register key value from web.Bcz security exception occur.
regards,
justin
|
|
|
|
|
|
What?
Regards,
Satips.
|
|
|
|
|
How get Dll's or OCX's ProgID?
|
|
|
|
|
Hi All,
I'm relatively new to C# and have finally come unstuck - so i think anyway. My problem is i have a couple of formula's and the first part is okay but when it gets to the second part i can't seem to get an answer. Below is a sample of what i'm doing and i was just wondering if anyone could give me a point in the right direction?? I have a feeling that it is because the total of sum2 comes back as a decimal value, any way let me know what you think??
int number1; (say value is 10)
int number2; (say value is 6)
int number3; (say value is 2)
int sum; (value would be 4)
int sum2; (should return value of 50)
int iHundred = 100;
sum = number1 - number2;
sum2 = number3 / sum * iHundred;
Also i should say when i debug number3, sum and iHundred all return values and sum2 returns 0
Thanks
Aj...
|
|
|
|
|
Instead of int go for Decimal datatype.
Regards,
Satips.
|
|
|
|
|
Satips wrote: Instead of int go for Decimal datatype.
I think that you mean Double.
Decimal has higher precision, but therefore it's also slower and harder to use. For any normal calculations Double is the preferred type.
---
single minded; short sighted; long gone;
|
|
|
|
|
Also the int iHundred is pointless. Just whenever you want to use iHundred type the number 100, its the same unless you have iHundred change.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|