|
So, do you have a solution with two executable projects in it? I suspect the error message is telling you exactly the problem.
Also, you are aware the UDP is a hopelessly unreliable protocol and you'll need to develop your own error checking if you don't want your messages going missing?
Regards,
Rob Philpott.
|
|
|
|
|
Sounds like the message is correct - suspect a pasted example that has its own main (???)
And I wouldn't go so far as "hopelessly" unreliable. There are times when UDP can be implemented with the same reliability as TCP - at least I "hope" so, or I might have to go back to the basement where I belong before I get to much farther along in my current project (see post above).
---------------------------------------------
Help... I'm embedded and I can't get out!
If they don't get the basic research and learning skills down then they'll end up having a very hard life (Either that or they'll become managers) - Micheal P Butler
|
|
|
|
|
Hi, i'm practicing with c# - c++ dll integration. I reached my first goal, that was to make the c# and c++ sides share a simple struct. This is what i did:
c++ side (NANUReader.dll)
--------------
typedef struct NANUINFO{
int a;
int b;
char* s;
double d;
}NANUINFO;
__declspec(dllexport) void callMe(NANUINFO* info){
info->a = 1;
info->b = 2;
info->s = "hellooo";
info->d = 5.57684;
}
c# side
-------------
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
struct NANUinfo
{
int a;
int b;
string s;
double d;
}
[System.Runtime.InteropServices.DllImport("NANUReader.dll")]
static extern void callMe(ref NANUinfo info);
void callDLLFuntion(){
NANUinfo info = new NANUinfo();
callMe(ref info);
--here info has been filled by the dll--
}
This worked.
Now i would find a way to pass the dll a reference to some sort of empty dynamic collection (like an empty List<nanuinfo>) and make the dll populate it with an unpredictable number of NANUinfo structs. In other words, in the c# side i need something like this:
void callDLLFuntion(){
SomeCollectionType<nanuinfo> infoCollection = new SomeCollectionType<nanuinfo>();
callMe(ref infoColletion);
--here infocollection should be full of NANUinfo structs--
}
I don't even know if this can be achieved. Any help?
Thanks
|
|
|
|
|
bonjour tout le monde
i'am doing pc oscilloscope usb(sine wave) using c#...it's a big headache to me.does anyone know where i could find an example of c# coding(or if someone has done this befor for a help).thanks for your help
|
|
|
|
|
|
I am using the code shown below to allow the user to click on a listview item and display a file associated with the item clicked.
However, It is failing at the indicated line because users are still holding down the mouse button while changing the listview selection via the keyboard arrow keys.
How can I prevent this from happening please?
void diaryListView_MouseUp(object sender, MouseEventArgs e)
{
int selectedSubItem =
this.GetSubItem(this.diaryListView, new Point(e.X, e.Y));
if (selectedSubItem != -1)
{
ListViewItem lvItem = diaryListView.SelectedItems[0]; *** FAILS HERE ***
var file = lvItem.SubItems[14].Text.ToString();
if (selectedSubItem == 0 & lvItem.SubItems[14].Text.ToString().Length > 0)
{
viewFile(file);
}
}
}
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
[DllImport("user32.dll")]
private extern static int SendMessage(
IntPtr hWnd, int wMsg, int wParam, ref RECT lParam);
public int GetSubItem(ListView lv, Point pt)
{
const int LVM_FIRST = 0X1000;
const int LVM_GETSUBITEMRECT = LVM_FIRST + 56;
const int LVIR_BOUNDS = 0;
ListViewItem.ListViewSubItem subItem = null;
int subItemIDX = -1;
RECT lviRect;
ListViewItem lvi = lv.GetItemAt(pt.X, pt.Y);
if (lvi == null && lv.SelectedItems.Count > 0)
lvi = lv.SelectedItems[0];
if (lvi != null)
{
int sendMessageVal = 0;
for (int i = 1; i < lvi.SubItems.Count; i++) {
subItem = lvi.SubItems[i];
lviRect = new RECT();
lviRect.Top = i;
lviRect.Left = LVIR_BOUNDS;
sendMessageVal =
SendMessage(lv.Handle,
LVM_GETSUBITEMRECT,
lvi.Index,
ref lviRect);
if (pt.X < lviRect.Left)
{
subItem = lvi.SubItems[0];
subItemIDX = 0;
break;
}
else if (pt.X >= lviRect.Left & pt.X <= lviRect.Right) {
subItemIDX = i;
break;
}
else
subItem = null;
}
}
if (subItem == null || lvi == null)
subItemIDX = -1;
return subItemIDX;
}</remarks></returns></summary>
modified on Friday, February 20, 2009 8:27 AM
|
|
|
|
|
kanchoette wrote: It is failing
isn't very descriptive; can you describe how it's failing?
Without that here are some comments anyway:
* why subscribe to the mouse up handler for this? like you said that will completely ignore the user hitting up and down on the keyboard. subscribing to diaryListView.SelectedIndexChanged would notify you any time the selection changes regardless of how the user made it happen.
* GetSubItem ? Why bother with this function? you're ignoring the index that was actually clicked and using zero instead, so why not just check if (diaryListView.SelectedItems.Count > 0) instead of if (selectedSubItem != -1) ?
* var file = lvItem.SubItems[14].Text.ToString(); -- what is this? Text is a string, then ToString() converts it to another string even though it already is one and then it's stored in a var even though you've jumped through hoops to ensure it's a string. Why? and why is it repeated in the conditional on the next line?
|
|
|
|
|
I fixed it by adding the top if statement
if (diaryListView.SelectedItems.Count > 0)
{
ListViewItem lvItem = diaryListView.SelectedItems[0];
var file = lvItem.SubItems[14].Text.ToString();
if (selectedSubItem == 0 & lvItem.SubItems[14].Text.ToString().Length > 0)
{
viewFile(file);
}
}
|
|
|
|
|
Hi, how can i create or delete a table in MsAccess using c# and Microsoft.Jet.OLEDB.4.0?
ty very much
Alessio
|
|
|
|
|
What are you having problems with? You need to call a command that executes a 'create' or 'drop' statement on the access database - have you written any code to do this?
It definitely isn't definatley
|
|
|
|
|
Bad Moon_Stick! Didn't you know that you've entered into A Contract with Legion the moment you helped someone? You are now required to write the homework for anyone who asks.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Ah crap - I wish I'd know that earlier!!
Sometimes it almost seems like it'd be better if I didn't try and help at all - it really does annoy me!!
It definitely isn't definatley
|
|
|
|
|
DataTable tabella = new DataTable("letturair");
DataColumn colonna;
DataRow righe;
OleDbCommand comando;
OleDbDataAdapter adattatore;
colonna = new DataColumn();
colonna.DataType = System.Type.GetType("System.String");
colonna.ColumnName = "CODICE";
tabella.Columns.Add(colonna);
string nomeColonna;
for (int i=1; i<=Convert.ToInt32(tbNumeroQuesiti.Text); i++)
{
nomeColonna="R"+Convert.ToString(i);
tabella.Columns.Add(nomeColonna, typeof(String));
}
....and now? how can i create my table in a Access document?
ty very much
|
|
|
|
|
using System.Data.OleDb;
then you will need to create instances of OleDbConnection and OleDbCommand
pass your database connection string to OleDbConnection then open the connection.
create an SQL Query[^] as a string and pass that, along with the OleDbConnection, to the OleDbCommand
then execute the OleDbCommand as required
p.s. dont forget to use command parameters if you have any UI values
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
When I asked if you had written any code, I meant, have you written any code that will create or delete a table?
If you try and write code (looking at google or documentation will be useful here) and have difficulty with something, I'll try and give some useful advice but I'm not going to write all the code for you.
Go and make some kind of an effort to solve the problem before you start asking questions - I won't offer any help until you've done that.
It definitely isn't definatley
|
|
|
|
|
Hi,
I'm using a DataGridView to display a number of files. I would like to use a ContextMenuStrip to give the user access to some basic functionality for manipulating the files. I have managed to do so, the context menu works and I have determined that the correct cells are being affected by the actions on the context menu. How ever, when I left click a file in my gridview the file is selected and thus highlighted. I would like this to happen when I right click the file to bring up the context menu too.
This snippet does the work if I disable the context menu:
private void viewFiles_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
viewSessions.Rows[e.RowIndex].Selected = true;
}
}
I guess that what I want is to execute this code before showing the context menu, right? Any ideas?
|
|
|
|
|
instead of attaching the context menu to the dataGridView leave it unattached
Then when you set the .Selected = true; in your above event handler add the follwing line
contextMenu1.Show(Cursor.Position);
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Hi Frnds
I want to implement a application in which i can open any file, image or video through mobile from remote place
Plz help me out It's urgent.......
Thanks in advance.......
modified on Friday, February 20, 2009 8:27 AM
|
|
|
|
|
Took me almost half an hour before I realised that it's not meant seriously! Good one!
I are troll
|
|
|
|
|
If u don't know to implement don't post ur comment.
|
|
|
|
|
If you don't know how to read
- f_off!
If you refuse to spell
- f_off and die!
If you won't make an effort
- f_off and die you m_f_er!
If you want others to do your homework
- f_off and die you m_f_ing p_drinking a_sucker!
Kapeesh?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
williamnw wrote: If you refuse to spell
- f_off and die!
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
|
Occassionally. Just occassionally. I get 'vexed' and I need to vent. It's a bit like those vile felines scratching at the nearest piece of tailoring there bi-cellular brains encounter.
You goive a guy a hint. He doesn't even take the hint and tries to snarl his yellow teeth at you. You know what I say? "Bring 'em on! And there damned cats!"
[btw thank you for the 5, have one back.]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hey hey now! What's all this? Are you trying to mimic my attitude?
|
|
|
|