|
Insted of Temp table, XML will be better
Happy Programming
-----
Abhijit
|
|
|
|
|
|
hi again,
one more doubt on this issue....
i want another form(form2) with text boxes to accept all the details and when i click on an update button on tis form the details should be shown on the data grid that is present on the form1....
ie i should have two forms:first form with data grid and form2 with text boxes for name ,roll number and classes ...
what is the logic ie how can i make theses two forms communicate....
thanks again guys
C#
|
|
|
|
|
|
sure Abhijit i will explain:
i have two windows form form1 and form2
in form one i have a datagrid and a "show button"
when i click on the show button the second from ie form2 will pop up....
in this form2 i have text boxes and a "update button"....and when i enter the details on the text box and click on the update button in form2 all the details will get updated on to the datagrid in form1
do i need to use delegates for this purpose.....
how cn do this....
Thanking you
C#
|
|
|
|
|
Thanks for Explining,
I am asuming your database has Roll, Name , Address , Marks fields
And Create a Load_Grid() Function on form_load()
Load_Grid()
{
Load data to grid();
}
Now see, in your datagrid there may be multiple records ? is it ?
Now read the key value from that row, and pass the value in the next form.
Supoose u select row 2 and roll=5, pass this to form 2, u can easily access the controls of other form just creating the object and access.
Now in Form2,
There is Three Text box,
Roll : txtroll
Name: txtName
Address : txtAddress
Now,
SQLCommand cmd=new sqlcommand("select * from student where roll='_RollVal',conn) // _RollVal is passed value
SqlDataReader dr=new Sqldatareader();
dr= cmm.executenonquery();
now u can get the value
txtRoll.Text=dr[0].text
txtName.Text=dr[0].text
Now change the vale in text box, and on click on UpdateButton .... Update database [ Just use Update Command to Update] and back to the Form1..... , and all refresh data will come to you grid, cause , load_grid() will call on Form Load.
Hope You like This..... And for any query ask me
Good luck
Happy Programming
-----------------
Abhijit Jana
Noida, India
|
|
|
|
|
|
But, unless you use a database u can't store data permanently. At least you have to use a XML or CSV file do store records.;)
|
|
|
|
|
i dont want to store anything abhi
i am trying to enter some detailes in one form and it shpould be shown in datagrid in another form.....if i donot stop the running and keep on updating i the datagrid will also get upgraded....
i almost did it using delegates
can u plz check the codes and tell me because i got the code from somewhere else
code form1::
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void UpdateGridView(string name, string roll, string Class)
{
string[] data = new string[] { name,roll,Class };
dataGridView1.Rows.Add(data);
}
private void button1_Click(object sender, EventArgs e)
{
Form2 obj = new Form2();
obj.StudentDetails = new namedelegate(this.UpdateGridView);
obj.ShowDialog();
obj.Close();
}
}
}
code for form2::
public delegate void namedelegate(string name,string roll,string Class) ;
public partial class Form2 : Form
{
public namedelegate StudentDetails; //creating an object of the delegate
public Form2()
{
InitializeComponent();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
StudentDetails( txtName.Text, txtRoll.Text, txtClass.Text);
}
private void txtName_TextChanged(object sender, EventArgs e)
{
}
}
}
Can you tell me how does the program flow work
thanking you
C#
|
|
|
|
|
Why u make that simple thing as complex, if you dont want to use database just use XML
<Student>
<roll>1</roll>
<Name>Abhijit</Name>
<Class>Microsoft</Class>
</student>
Use XMLReader and Write Object to Read and Write.
It's Very Simple,
U can Create and Delete The XML File RunTime Also... So, No Overhead !!!
Best Regards
-----------------
Abhijit Jana
View My CodeProject Articles
"Success is Journey it's not a destination"
|
|
|
|
|
|
just try it and let me know when done
|
|
|
|
|
Sure Will do so ......thanks again
C#
|
|
|
|
|
How to Include and call IOfficeAntiVirus in my program for call Antivirus software?
use C#.
|
|
|
|
|
I am not very clear about your requirement, however if you just want to run some external Anti-Virus application using code, you may do so using System.Diagnostics.Process.Start () method.
Such as –
System.Diagnostics.Process.Start("c:\\antivirus.exe");
I case if you want to pass some parameter to this application, such as some file name which needs to be scanned, you may do so by passing file name as an argument in this function.
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
There's an abstrat class in .NET
public abstract class CollectionBase : IList, ICollection, IEnumerable{...}
However, No definition or declaration of IList 's functions are found in CollectionBase .
How could this ever happen? If it's an abstract class, it's allowed to not implement its interface?
Thanks everybody
|
|
|
|
|
Yes, only concrete classes must.
|
|
|
|
|
Thanks, but why won't the following code compile?
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
interface A{<br />
void A();<br />
}<br />
abstract class B : A<br />
{<br />
}<br />
<br />
}<br />
I got an error!
The compiler says I should implement A.A() in abstract class B.
|
|
|
|
|
That's exactly the same concept - you're not declaring a concrete class anywhere.
If you add
class C : B
{
} then you'll get a compiler error.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
In my previous example, the abstract B results in an error if it doesn't contain method A.A() .
So I guess it is necessary to implement an interface even in an abstract class
|
|
|
|
|
My earlier answer wasn't quite as correct as I would have preferred.
You need the abstract stub, but it's still not an implementation.
|
|
|
|
|
I built a small little application that every time a certain extension is clicked on, this application opens the file. On my website when you click on certain links it returns this file extension and in IE & Firefox they both prompt me on what to do with the file. I would like them to not prompt me and just open the file in the default application that is assigned to that extension in windows.
Can someone help me figure this out?
|
|
|
|
|
Brad Wick wrote: I would like them to not prompt me and just open the file in the default application that is assigned to that extension in windows.
Then tell Windows what you want it to do with them.
|
|
|
|
|
I did. If I have a file on my desktop and I double click on it, it opens my application and displays the contents of the file. When IE locates this extension, then it asks me if I want to Open, Save or Cancel. I want it to always just open this type of file.
|
|
|
|
|
Then I don't know; it works for me.
|
|
|
|