|
thank you for your reply.
how will i do it, i dont know. i try this code but i can change or add new row at one time.
my present code id like this:
private void button2_Click(object sender, System.EventArgs e)
{
int satir;
satir=dataGrid4.CurrentRowIndex;
if(dG4SatirSay==satir)
{
DataTable tablo;
DataRow kayit;
tablo=alPersOzluk.Tables[0];
kayit=tablo.NewRow();
kayit[1]=dataGrid4[satir,1];
string kaynakGor="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=vt1.mdb";
OleDbConnection baglantiGor=new OleDbConnection(kaynakGor);
baglantiGor.Open();
string gorevAdi=dataGrid4[satir,2].ToString();
string sorguGor="SELECT GorevNo FROM PGorev Where Gorev='"+gorevAdi+"'";
OleDbCommand komutGor=new OleDbCommand(sorguGor,baglantiGor);
OleDbDataReader ordGor= komutGor.ExecuteReader();
ordGor.Read();
kayit[2]=ordGor[0].ToString();
ordGor.Close();
baglantiGor.Close();
kayit[3]=dataGrid4[satir,3];
kayit[4]=dataGrid4[satir,4];
kayit[5]=dataGrid4[satir,5];
kayit[6]=dataGrid4[satir,6];
kayit[7]=dataGrid4[satir,7];
kayit[8]=dataGrid4[satir,8];
string kaynakPrs="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=vt1.mdb";
OleDbConnection baglantiPrs=new OleDbConnection(kaynakPrs);
baglantiPrs.Open();
string sorguPrs=@"Insert Into PersonelOzluk(AdiSoyadi,Gorevi,TelefonNo,Adresi,TCKimlikNo,VergiNo,DogumTarihi,KanGrubu) Values ('"+kayit[1]+"','"+kayit[2]+"','"+kayit[3]+"','"+kayit[4]+"','"+kayit[5]+"','"+kayit[6]+"','"+kayit[7]+"','"+kayit[8]+"')";
OleDbCommand komutPrs=new OleDbCommand(sorguPrs,baglantiPrs);
komutPrs.ExecuteNonQuery();
baglantiPrs.Close();
}
else
{
DataTable tablo;
DataRow kayit;
tablo=alPersOzluk.Tables[0];
kayit=tablo.NewRow();
kayit[0]=dataGrid4[satir,0];
kayit[1]=dataGrid4[satir,1];
string kaynakGor="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=vt1.mdb";
OleDbConnection baglantiGor=new OleDbConnection(kaynakGor);
baglantiGor.Open();
string gorevAdi=dataGrid4[satir,2].ToString();
string sorguGor="SELECT GorevNo FROM PGorev Where Gorev='"+gorevAdi+"'";
OleDbCommand komutGor=new OleDbCommand(sorguGor,baglantiGor);
OleDbDataReader ordGor= komutGor.ExecuteReader();
ordGor.Read();
kayit[2]=ordGor[0].ToString();
ordGor.Close();
baglantiGor.Close();
kayit[3]=dataGrid4[satir,3];
kayit[4]=dataGrid4[satir,4];
kayit[5]=dataGrid4[satir,5];
kayit[6]=dataGrid4[satir,6];
kayit[7]=dataGrid4[satir,7];
kayit[8]=dataGrid4[satir,8];
string kaynakPrs="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=vt1.mdb";
OleDbConnection baglantiPrs=new OleDbConnection(kaynakPrs);
baglantiPrs.Open();
string sorguPrs="Update PersonelOzluk Set AdiSoyadi='"+kayit[1]+"',Gorevi='"+kayit[2]+"',TelefonNo='"+kayit[3]+"',Adresi='"+kayit[4]+"',TCKimlikNo='"+kayit[5]+"',VergiNo='"+kayit[6]+"',DogumTarihi='"+kayit[7]+"',KanGrubu='"+kayit[8]+"' Where PersonelNo="+kayit[0]+"";
OleDbCommand komutPrs=new OleDbCommand(sorguPrs,baglantiPrs);
komutPrs.ExecuteNonQuery();
baglantiPrs.Close();
}
}
|
|
|
|
|
Hello.
I have a problem
I've developed control CompressionItemControl and want to add it to listbox as an item, but it doesn't show it(it only shows that smth added)
Could you help me to create list of controls in listbox?
Thanks, Sergey
|
|
|
|
|
You can't add child windows to a ListBox, a list item is a predefined thing, and it renders text and perhaps an icon.
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 )
|
|
|
|
|
So i have to develop a separate control to show such controls? or there is a standard decision???
Thanks
|
|
|
|
|
Yes, if you want a list of controls, you need to create something. Or, just render/position the controls in a row, I guess.
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 need to display icons next to items in a listview (using gridview) with WPF. Does anyone have a sample of this ?
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
Normally I would suggest using an asp:Image control, but I am not sure if the ImageUrl support Icon files. Why wouldn't you use gif or jpg files instead? Anyway, it might work with icon files. First create a new column that is a template column in your gridview. Once you have a template column you have an ItemTemplate and an EditTemplate. Create an asp:Image control in the itemtemplate and bind it to the correct variable that has the imageurl in it. If you allow editing to your grid view you will need to add it there as well if you want the image to be seen when editing.
Hope that helps.
Ben
|
|
|
|
|
hi
how can i convert a decimal value to its ASCII equivalent in C#?
thanks
|
|
|
|
|
Probably char c = 65 would do it.
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 )
|
|
|
|
|
try this code:
<br />
private string ConvertToAscii(decimal value)<br />
{<br />
Encoding ascii = Encoding.UTF32;<br />
<br />
char chr = (char)value;<br />
Byte[] bty = ascii.GetBytes(chr .ToString());<br />
<br />
return ascii.GetString((bty));<br />
}<br />
|
|
|
|
|
Why on earth does it take a decimal ?
This looks like a convoluted mess to me. I just did this and traced in the debugger:
int n = (int)'C';
char c = (char)n;
it worked just fine.
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 )
|
|
|
|
|
Hi,
My question is "How to send a user defined variable value while calling eventhandler.
Pls go thru the below example:
1. I have an array of Pictureboxes arranged on a Panel
2. I have handled the Click event on PictureBoxes as below but dont know:
how to pass "string FilePath" as part of "Object sender"
<br />
<br />
string FilePath;
picBoxes[index].Click += new System.EventHandler(ClickHandler);<br />
<br />
...<br />
...<br />
<br />
public void ClickHandler(Object sender, System.EventArgs e)<br />
{<br />
<br />
PictureBox pbx = new PictureBox();<br />
pbx = (PictureBox) ((System.Windows.Forms.PictureBox)sender);<br />
<br />
<br />
}<br />
<br />
Thanks
|
|
|
|
|
Hello,
I think what you want to do is only possible with an Inherited class and the usage of Custom Eventargs.
1) Inherit a class from PictureBox
public class SpecialPictureBox : System.Windows.Forms.PictureBox
2) Add a string property FilePath
private string _filepath = "";
[System.ComponentModel.DefaultValue("")]
public string FilePath
{
get
{
return _filepath;
}
set
{
_filepath = value;
}
}
3)Inherit a class from System.EventArgs with a string member
public class SpecialEventArgs : System.EventArgs
{
public string filepath;
public SpecialEventArgs(string _filepath)
{
filepath= _filepath;
}
}
4)Create a delegate for your special event in your SpecialPictureBox class, which uses the SpecialEventArgs.
public delegate void SpecialEvent(object sender, SpecialEventArgs specialEA);
5)Create an event which uses the delegate
public event SpecialEvent SpecialChanged;
6)override the OnClick event of your PictureBox and fire the event, with the Filepath property.
if(SpecialChanged!=null)
{
SpecialChanged(this, new SpecialEventArgs(this.FilePath));
}
7)In your Form Handle the SpecialChanged event and set the FilePath property
yourSpecialPictureBox.FilePath = "yourpath";
yourSpecialPictureBox.SpecialChanged+= new YourNamespace.SpecialEvent(yourSpecialPictureBox_SpecialChanged);
private void yourSpecialPictureBox_SpecialChanged(object sender, SpecialEventArgs specialEA)
{
}
Hope it helps!
-- modified at 5:35 Friday 27th July, 2007
All the best,
Martin
|
|
|
|
|
Oh wow, didnt think about it! let me try. Thank you Martin.
|
|
|
|
|
You are wellcome!
Hope it works out for you.
Please let us know.
All the best,
Martin
|
|
|
|
|
In .NET Framework 2.0, if you're following the EventArgs pattern, you don't need to declare your own delegate, you can use the generic EventHandler<T> delegate. Saves time and metadata space.
So you'd have
public event EventHandler<SpecialEventArgs> SpecialChanged;
yourSpecialPictureBox.SpecialChanged +=
new EventHandler<SpecialEventArgs>(yourSpecialPictureBox_SpecialChanged); I'm finding this pretty handy.
|
|
|
|
|
Hello Mike,
Mike Dimmick wrote: In .NET Framework 2.0,
I'm one of the poor, who have to work with .Net1.1 only.
But thanks for the info!
All the best,
Martin
|
|
|
|
|
Yes, This solution works properly! though a bit advanced for me!
thanks
|
|
|
|
|
Glad I could help!
Thanks for the feedback!
All the best,
Martin
|
|
|
|
|
Hi,
I want include the some Matlab lib files in my C# progrm than what is a procedure to link the matlab with C#.Net?
|
|
|
|
|
There isn't one, unless matlab comes in dlls you can p/invoke
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 )
|
|
|
|
|
There is no direct way to use the Matlab files in C# however, using the Matlab Builder for .Net you can convert Matlab functions to .Net methods. Write all the required function in m-code (encapsulate) and build using .Net Builder which will generate a .Net Assembly file which can be used in your C# program.
You will need Matlab version R2006a (with MATLAB Builder for .NET).
Also checkout the website http://www.mathworks.com/access/helpdesk/help/toolbox/dotnetbuilder/[^]
Hope this works!
~Sky
|
|
|
|
|
Hi,I have a problem. I have a DirectX application written in C++ and i want to embed it in a C# Windows form. Is that possible and how?
|
|
|
|
|
Not really, no, you can't embedd one app in another in a supportable way.
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 )
|
|
|
|