|
I have a solution with a managed C++ project, and a C# project which references the C++ project.
My C++ project contains the following:
struct AAA { ... };
typedef public enum BBB { ... };
public delegate void CallbackDelegate(AAA * a, BBB b);
class SomeClass
{
...
static void RegisterCallback(CallbackDelegate^ callback);
...
} My C# project is supposed to use RegisterCallback() .
I can't use the CallbackDelegate in my C# project though, because it contains a pointer.
So I've declared the following in C# hoping that .NET would do the conversions for me :
[StructLayout(LayoutKind.Sequential)]
public struct AAA { ... }
public enum BBB: int { ... }
public delegate void CallbackDelegate(AAA a, BBB b); However, now I can't send my CallbackDelegate as a parameter to RegisterCallback() because it's not the same signature.
I'm new to all of this C++.NET s**t, so I don't really know how to use it in C#.
Could anyone point me in the right direction?
Thanks in advance,
Shy.
|
|
|
|
|
shyagam wrote: I can't use the CallbackDelegate in my C# project though, because it contains a pointer.
Couldn't you just create an unsafe delegate in C#?
See: unsafe (C# Reference) [^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi I just wanted to know the proper way of updating a DataRow.
If I have a DataTable say locDTable which already has rows populated through
Iterate<br />
{<br />
DataRow locDRow = locDTable.NewRow();<br />
locDTable.Rows.Add(locDRow);<br />
}
How do I access (and modify a particular column entry for a particular row?
The way I would do it something like:
locDTable.Rows[rowIndex][colIndex] = newValue;
Is this the proper way?
Thank you in advance!
j11Software
|
|
|
|
|
Hi
Maybe, instead of access to the column by an index you can use strings constants to access to columns. It seems more elegant and if you change the structure of the table the acces to the previous column doesn't change.
To access to a particular row the only way is by an index.
|
|
|
|
|
I agree 100% with the constants approach for column names, we do that all the time here and has paid of on numerous occasions. We also do it for the table names.
It decouples you from Database especially for column name changes (just change constant literal) as well as makes the code much more readable.
|
|
|
|
|
hi, every one i get this exception that i couldnot come up with a solution. reading severla forum i made sure that all dll file are copied but still i get the error. any help plz point out.
System.Web.HttpException: Exception of type System.Web.HttpException was
thrown. ---> System.IO.FileNotFoundException: ...get_aspx_ver.aspx
|
|
|
|
|
You might have copied the DLL's but it looks like you missed out that aspx file
|
|
|
|
|
Hi Members,
Plz tell me how to encrypt/decrypt a string in c sharp.net using cryptography namespace.
thanks n Regards ,
Ahmad
ahmad.osama1984@gmail.com
|
|
|
|
|
You should use CryptoStream class. Click here[^].
Regards
|
|
|
|
|
|
Hi All,
Facing a peculiar problem.
I have MajicAjax implemented in my web page & the code runs perfect(My M/c's OS - Win 2000 Professional),whereas on the Tester's M/C it gives me script library '/AjaxCallObject.js' error on loading the same page(Tester's OS - Win XP). Furthermore, this problem persists only in some selective M/c's running on Win XP. Found some useful sites & tried the same but with no success.
Can anyone plz help asap...
Thanks in advance.
Yogesh J.
|
|
|
|
|
multi select list box coding using mysql stored procedure
|
|
|
|
|
I'm writing a program in C# 2005 Express and one of its functions is to scan the hard drives of the computer for specific files.
However, due to the diversity of the machines this program will run on, I cannot guarantee the drive letters for each hard drive.
Is there any way I can find the available drives so I can limit and speed up my scan?
I know I could use HKLM>Software>Microsoft>Windows>CurrentVersion>Explorer>MountPoints2
to find what drives are there.... but that doesn't distinguish between drive types (Hard Drive, Floppy Drie, CD Drive).
And help would be greatly appreciated.
------------------------
using System.People;
Person me = new Person();
me.Certifications = null;
me.Experience = little;
me.WantsToLearn = true;
me.InSchool = true;
me.AskQuestions("C# .NET 2003");
|
|
|
|
|
System.Environment.GetLogicalDrives()
« Superman »
|
|
|
|
|
Ha.
Thanks.
I can use that with System.IO.DriveInfo to get what I need.
That's what I love about CodeProject... response within a half hour.
------------------------
using System.People;
Person me = new Person();
me.Certifications = null;
me.Experience = little;
me.WantsToLearn = true;
me.InSchool = true;
me.AskQuestions("C# .NET 2003");
|
|
|
|
|
plz help me i have made Window Applcation and i want to save the exe in Startup. how it is possible
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wli
|
|
|
|
|
Sanjib Raj wrote: Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wli
sanjit, there are so many other ways to memorize your email id. This looks really awkward. Please remove them from your signature.
Sanjib Raj wrote: plz help me i have made Window Applcation and i want to save the exe in Startup. how it is possible
The simple way is to create a shortcut to theStart Menu\Programs\Startup folder
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
Hi,
If you want your programme in the start up than put the path in the registry for startup..
nishu
|
|
|
|
|
Dear all.
i am making web application using asp.net and C#(Visual studio 2005). i have listbox(with multi select option) on web form. I am able to capture data through loop. now i want to know how i can place this loop data into single statement for insert statement.i am using prepared statement that is my insert query is
"insert into agentmst(agentid,agentname,agentservice1,agentservice2,agentservice3,agentservice4,agentservice5,branchid,acreatedby,acreated,Ipadd) values(@aId,@aname,@serv1,@serv2,@serv3,@serv4,@serv5,@branchid,@crby,getdate(),@ip)";
(i am ristricted myselef to atmost five listbox option).now i am populating listbox option as
parm3.ParameterName = "@serv1";
parm3.Value = names[0];
parm4.ParameterName = "@serv2";
parm4.Value = names[1];
parm5.ParameterName = "@serv3";
parm5.Value = names[2];
parm6.ParameterName = "@serv4";
parm6.Value = names[3];
parm7.ParameterName = "@serv5";
parm7.Value = names[4];
now i am able to fetch listbox data correctly through loop as
for (int i = 0; i < listBox1.Items.Count; i++)
{
if (listBox1.Items[i].Selected == true)
{
for (int j = 1; j < 7; j++)
{
names[j] = listBox1.Items[i].Text;
Response.Write(names[j]);
break;
}
}
}
Now my question is how i can use this in insert statment. Please Guide me.
Where i am going wrong.
Any one knowing Please guide me.
Thanks
regards
imran khan
|
|
|
|
|
remember that the listbox in this powerfull lenguage c#, have many components that you can use in your project, for intance, only you need load the information in a datatable for example, and then tell to the listbox, and you can use too a combobox, the properties datasource that you load from a datatable:
public void LoadDatatable(ref system.data.datatable some)
{
cmd = new SqlCommand("yourStoredProcedureOrStatement",con);
cmd.CommandType = CommandType.StoredProcedure;
try
{
adapt = new SqlDataAdapter(cmd);
adapt.Fill(some);
}
catch(Exception ex){throw ex;}
finally
{
con.Close();
}
}
system.data.datatable p=new system.data.datatable();
LoadDatatable(ref p);
and after all this, only rest that you tell to the combobox or listbox, anyone that the properties DataSource = p;
and the way too show the thinks that was load:
ListBox.DataSource = p;
ListBox.DisplayMember = "The name of the thinks that you like show";
ListBox.ValueMember = "A id, if exist, only to give more handle to this control";
ok I hope that this thinks help you....
one think: Forgive me by my English ok, because in my contry this idioms i'snt speak a lot....
if you wanna another answer o whatever please write me
e-mail:joelintel@gmail.com
|
|
|
|
|
Thanks for reply.
But i already filled the listbox in page load event. Now On Save Button, i have to get those selected item in the listbox. and add to the parameter.
My quetion is how can i assaign these selected option values to parameter used.
regards
imran khan
|
|
|
|
|
sorry for the long time, but I can'nt seat before my pc in some many hours, ok your question is simple
the best mode to give you the answer is with a example....
if you have a listbox and in them properties selection mode you put "MultiSimple", and you do a correct add of the elements to show in run time, you selected the item that you need to save in your DB maybe using that
int [] a;
int p=0;
p=this.listBox1 .SelectedIndices.Count ;
a=new int[p];
for (int i = 0;i < p;i++)
a[i] = this.listBox1 .SelectedIndices [i];
and in the array "a" you have all the position that be selected, the rest i think you know, make a loop wih that and with the class SqlParameter add all this position or the name of the item under this position....
is a plaesure help you, if you have any question tell me ok....
|
|
|
|
|
hi, in the last reply, I show you how you can select the rows in a listbox, but how you no tell my any more, I expect that you stand all....
regards
sno-1
|
|
|
|
|
sir
i want multiselect listbox how to save in database please coding and query
|
|
|
|
|
i have made a system tray in WindowApplication C# i want to run it when System Starts as Sql Server Service manager Starts or System Tray will start automatically, plz help me?
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wli
|
|
|
|