|
|
Why would want to reinvent the wheel?
|
|
|
|
|
|
Hello all,
i'm trying to do sequential reading from a OleDbDataReader that is retrieving an xml stream generated (string) in the sql server but i end up with an invalid cast exception.
The same code works like a charm using SqlDataReader, but for some reason, i had to integrate with another connection object and retrofit the code to use OleDbDataReader.
Have anyone ever experienced something like this?
_reader = _command.ExecuteReader(CommandBehavior.SequentialAccess);
while (_reader.Read())
{
_index = 0; ;
_read = _reader.GetChars(0, _index, _chbuff, 0, BUFF_SIZE);
while (_read > 0)
{
_writer.Write(_chbuff, 0, (int)_read);
_writer.Flush();
_index += _read;
_read = _reader.GetChars(0, _index, _chbuff, 0, BUFF_SIZE);
}
}
|
|
|
|
|
Use pre tags. Where does the error happen? What are the data types?
I've never heard of someone trying to do what you're trying to do; it looks weird.
|
|
|
|
|
Say I have two datagridviews (DG1, DG2) each with its own contextmenu, (Menu1,Menu2). Menu1 has menu items Save,Delete,Print and Menu2 has Save,Delete,Print now I would like to make one function that looks like
private void Context_Menu_Save(object sender, EventArgs e){
DataGridView DG = (DataGridView)sender;
}
and then do what I need to do.
The problem is that sender is the menuitem not the Datagridview that menuitem is associated with, so how do I find out which DataGridView's context menu was selected?
|
|
|
|
|
Here are a couple of ways to overcome your problem:
1. the MenuItem belongs to some top-level menu, use its Parent property to find that top-level menu (the ContextMenu might be hierarchical); once you found the ContextMenu, that one has a SourceControl property which will point to the Control on which you right-clicked.
2. you could use the Tag property of the MenuItem and store something there, e.g. the underlying Control.
3. you could set up a dictionary that maps MenuItems to Controls.
4. you could organize a class member "lastDataGridViewClicked" and set it in the MouseDown handler of all DGVs.
#1 requires no set-up effort, it does need a loop to cope with hierarchical menus though.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Did you check the EventArgs? Sometimes they stuff things in like the OriginalSource, etc. Besides, how are you throwing up the context menu?
|
|
|
|
|
Yes I looked in the eventargs didn't see anything in there either.
And I'm throwing up the context menu via right click. (Not sure if that is what your asking)
But I solved the problem by using the Tag property as suggested earlier.
|
|
|
|
|
Try this:
ToolStripMenuItem itm = sender as ToolStripMenuItem;
if (itm != null)
{
ContextMenuStrip cm = (ContextMenuStrip)itm.Owner;
MessageBox.Show(cm.SourceControl.ToString());
}
Obviously I'm only showing the control in a MessageBox . You can do whatever you need to with it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
hi
i made message-box -> a form that has label for message and label for title
and OK button (do nothing).
i can rise this message from any form in my program.
i need message-box that has yes button and no button, and to know
if it pressed yes or no
how to do it ?
can i get any sample code for this ?
|
|
|
|
|
|
A dialog (i.e. a Form shown with ShowDialog) will close and return a DialogResult once one of its buttons is clicked, provided that button has its DialogResult set to something other than DialogResult.None, so use Visual Designer or your own code to assign dialog results to the buttons that should close the dialog, and capture the ShowDialog()'s return value.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
hi guies
i want program to draw and send this drawing to any one
in chatting program by c# with gdi+ technique
|
|
|
|
|
That's nice.
Please read this[^]
If you have a problem and need help then ask, don't just ask for code.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
|
but I don't have time to create new one
I want read in exist one to get idea
and develope my project
|
|
|
|
|
Well, considering you've been asking about this for months now and haven't gotten anywhere because you haven't done any of the work required up till now, the chances of you getting a project like this completed on time are now zero.
Now, IF you con some poor schmuck into giving you said source code, you have no chance of understanding it so when YOUR implementation breaks, you have no hope of supporting/fixing it in a timely fashion.
|
|
|
|
|
good luck
I cannot remember: What did I before google?
|
|
|
|
|
So, basically you are asking us to help you cheat. Them, if you pass your course, I assume you will want to get a job where you will be expected to write code - will we be expected to help you cheat then? Will you give us your salary?
I'm sorry, but I have absolutely no sympathy for you. You have wasted your time, and you are going to fail. I hear that Burger King are hiring.
|
|
|
|
|
Burger King still expects its employees to know how to follow instructions.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
You need to give your email address so we know where to send the source code to.
|
|
|
|
|
my email memo_aljabri11@hotmail.com
|
|
|
|
|
do
{
AskForCode();
}while(user == ID10T)
I sense an infinate loop
I know the language. I've read a book. - _Madmatt
|
|
|
|