|
Perhaps one way is to use a pointer ? You can set up a struct so that you specify how the bytes are laid out.
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 )
|
|
|
|
|
If you don't want that, what do you want then? What should the result be?
---
single minded; short sighted; long gone;
|
|
|
|
|
<FONT color=Blue>using</FONT> System<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>using</FONT> System<FONT color=DarkBlue>.</FONT>Runtime<FONT color=DarkBlue>.</FONT>InteropServices<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>namespace</FONT> ConsoleApplication9
<FONT color=DarkBlue>{</FONT>
<FONT color=Blue>class</FONT> <FONT color=Teal>Program</FONT>
<FONT color=DarkBlue>{</FONT>
<FONT color=DarkGreen>
<FONT color=DarkBlue>[</FONT><FONT color=Teal>StructLayout</FONT><FONT color=DarkBlue>(</FONT><FONT color=Teal>LayoutKind</FONT><FONT color=DarkBlue>.</FONT>Sequential<FONT color=DarkBlue>,</FONT> Pack<FONT color=DarkBlue>=</FONT><FONT color=Red>1</FONT><FONT color=DarkBlue>)</FONT><FONT color=DarkBlue>]</FONT>
<FONT color=Blue>public</FONT> <FONT color=Blue>struct</FONT> <FONT color=Teal>Message</FONT>
<FONT color=DarkBlue>{</FONT>
<FONT color=Blue>public</FONT> <FONT color=Blue>byte</FONT> id<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>public</FONT> <FONT color=Blue>int</FONT> value1<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>public</FONT> <FONT color=Blue>int</FONT> value2<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>public</FONT> <FONT color=Blue>byte</FONT> chkSum<FONT color=DarkBlue>;</FONT>
<FONT color=DarkBlue>}</FONT>
<FONT color=Blue>static</FONT> <FONT color=Blue>unsafe</FONT> <FONT color=Blue>void</FONT> Main<FONT color=DarkBlue>(</FONT><FONT color=Blue>string</FONT><FONT color=DarkBlue>[]</FONT> args<FONT color=DarkBlue>)</FONT>
<FONT color=DarkBlue>{</FONT>
<FONT color=Teal>Message</FONT> m <FONT color=DarkBlue>=</FONT> <FONT color=Blue>new</FONT> <FONT color=Teal>Message</FONT><FONT color=DarkBlue>(</FONT><FONT color=DarkBlue>)</FONT><FONT color=DarkBlue>;</FONT>
<FONT color=Blue>int</FONT> size <FONT color=DarkBlue>=</FONT> <FONT color=Blue>sizeof</FONT><FONT color=DarkBlue>(</FONT><FONT color=Teal>Message</FONT><FONT color=DarkBlue>)</FONT><FONT color=DarkBlue>;</FONT>
<FONT color=Blue>byte</FONT><FONT color=DarkBlue>[]</FONT> output <FONT color=DarkBlue>=</FONT> <FONT color=Blue>new</FONT> <FONT color=Blue>byte</FONT><FONT color=DarkBlue>[</FONT>size<FONT color=DarkBlue>]</FONT><FONT color=DarkBlue>;</FONT>
<FONT color=Blue>byte</FONT><FONT color=DarkBlue>*</FONT> p <FONT color=DarkBlue>=</FONT> <FONT color=DarkBlue>(</FONT><FONT color=Blue>byte</FONT><FONT color=DarkBlue>*</FONT><FONT color=DarkBlue>)</FONT><FONT color=DarkBlue>&</FONT>m<FONT color=DarkBlue>;</FONT>
<FONT color=Blue>for</FONT> <FONT color=DarkBlue>(</FONT><FONT color=Blue>int</FONT> i <FONT color=DarkBlue>=</FONT> <FONT color=Red>0</FONT><FONT color=DarkBlue>;</FONT> i <FONT color=DarkBlue><</FONT> size<FONT color=DarkBlue>;</FONT> i<FONT color=DarkBlue>++</FONT><FONT color=DarkBlue>)</FONT>
<FONT color=DarkBlue>{</FONT>
output<FONT color=DarkBlue>[</FONT>i<FONT color=DarkBlue>]</FONT> <FONT color=DarkBlue>=</FONT> p<FONT color=DarkBlue>[</FONT>i<FONT color=DarkBlue>]</FONT><FONT color=DarkBlue>;</FONT>
<FONT color=DarkBlue>}</FONT>
<FONT color=Teal>Console</FONT><FONT color=DarkBlue>.</FONT>ReadLine<FONT color=DarkBlue>(</FONT><FONT color=DarkBlue>)</FONT><FONT color=DarkBlue>;</FONT>
<FONT color=DarkBlue>}</FONT>
<FONT color=DarkBlue>}</FONT>
<FONT color=DarkBlue>}</FONT>
|
|
|
|
|
Use Serialization ? If the client is using .net
|
|
|
|
|
Hello Friends
I have one problem regrading mail. in my system i, there is reqrment to attech perticular file and sent it to client. so that i have to use outlook and mailto option
For that reason i am using
System.Diagnostics.Process.Start("mailto:dhaval@yahoo.com?body=hello&subject=hi&attachment=c:\\hello.gif");
My problem is that everything work fine but attechment create some problem for me.
In outlook window i have not any attechment
Please Give me som guideline..
Happy programming.................
|
|
|
|
|
You can use MAPI, but I don't think you can send an attachment with a mailto
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 )
|
|
|
|
|
Dear fellows
I have problem about which i donot from where i can get help.
What is Working:
I have made a ASP.NET (C#) application that is reading Data from Excel (cell b cell). That is working fine and i can check it in browser.
Problem:
Now using this code i made a web part in C# and i want to show it in SharPoint Server 2007 site page. Now that is not working , thats mean not showing the web part on the page.
And when i comment the excel ralated code in web part coding and check it at SharePoint server, web part works.
I donot know what to do, Please Help
Thanks
Asif khan
|
|
|
|
|
Hi All,
I want to find find all the device around my PC or Device, How can i do that
i broadcast message, all client around for responding but not able to collect all the message
plz help me to find the answer
With Regards
Amjath
|
|
|
|
|
Hello,
In .Net < 2.0 you have to use System.Management functionalities.
ArrayList drives = new ArrayList();
using(ManagementObjectSearcher DriveSearch = new ManagementObjectSearcher(new SelectQuery("Select * from Win32_LogicalDisk")))
{
using(ManagementObjectCollection moDriveCollection = DriveSearch.Get())
{
foreach(ManagementObject mo in moDriveCollection)
{
LogicalDriveInfo driveinfo = new LogicalDriveInfo(mo);
if(this[driveinfo.Name] == null)
drives.Add(driveinfo);
mo.Dispose();
}
}
}
For .Net >= 2.0 you could use DriveInfo.GetDrives()[^]
All the best,
Martin
|
|
|
|
|
Hi Martin,
Thanks for ur valuable inputs.
i will explain in detail wat i want, i have 1 details connected to my pc that device associate to many wireless clinet, i want get the information abt that wireless devices,
how can i do that
With Regards
Amjath
|
|
|
|
|
Does anyone have a simple example or steps on how to print a datagrid with paging and sorting? I would like to attach the function to a button control on the form and then once clicked send the entire datagrid with whole data to the printer
sameer Gupta
|
|
|
|
|
i use datagrid and i make changes and add new rows. and i want to save all of this changes and new rows with pressing a button, or without pressing a button when i make changes it will be save, may be it can be save when going another row
|
|
|
|
|
YOu don't say where the data comes from. Basically, if it's a database, you need to grab the new data and store it there, just like you had to pull the old data out.
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 )
|
|
|
|
|
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 )
|
|
|
|