|
I have a datagridview that is bound to a datatable in my application. I want to delete a row based on a value in a column. I have the code to remove the row from the datatable and it removes it from the datagridview on the refresh for rows 1-x. Here is my issue when I change the value on the first row(0) to delete it, I can't? Any help would be appreciated.
|
|
|
|
|
Clarify what you mean by, "I can't". If the row is deleted properly from the underlying datasource, then it will be removed from grid when properly refreshed.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi
i am just a trainee but in my opinion is try to use query as select statement by adding order by to that statement
|
|
|
|
|
Hi
I'm trying to create a button that would launch the default media player and start playing the first track of the Audio part of my mixed-mode CD.
Can someone please help me ? I'd like my button to do exactly the same as if I did a right_Click on my CD in the explorer and click on Play in the menu.
I can't use a Process.Play as it would open the Data part of the CD.
I tried with a shellexecute but it doesn't work.
Here is my code:
string CdPath = drive.ToString();
ShellExecute(IntPtr.Zero, "Play", CdPath, "", "",1);
Any help would be really appreciated !
The play function doesn't do anything. When I put Open instead, it opens a explorer window with the list of files on the cd...
Thanks a lot !
Michel
|
|
|
|
|
i have report retrieve data from 3 stored procedures
it was work correctly without any error
suddenly
it isn't retrieving data although the stored proceures still retrieve in sql server 2005
pls any one can help me??
or tell me how i can fix it??
|
|
|
|
|
This appears to be a database issue and probably has nothing to do with C#.
|
|
|
|
|
hi, could anyone give me a clue on how to select multiple controls(say textbox forexample) by pressing ctrl key? Thanks in advance!
|
|
|
|
|
Please clarify what you are asking to do.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Your question isn't very clear.
If you mean selecting controls in design view, you can simply press and hold the Ctrl key, and click on the controls you wish to select.
Alternatively, you could just click and drag to select multiple controls (just like when you're selecting multiple icons/folders in Windows Explorer).
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
If you are talking about adding controls to a collection at runtime, the following code will detect whether or not the CTRL key is currently pressed:
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
{
MessageBox.Show("CTRL key is pressed.");
}
You could add an event handler to the Click event of each control you create so that you can detect if CTRL was pressed while it was clicked. FYI, you can use the same event handler for all your controls. And that event handler can add the control to the collection of controls.
|
|
|
|
|
thank you very much for the exact answer . And when you say control collection, do you mean "System.Windows.Forms.Form.ControlCollection"?
|
|
|
|
|
List<Control>, though ControlCollection might work too.
|
|
|
|
|
I guess that your means is :
When pressing the Ctrl button, click ten controls one by one, then this ten controls will all be selected.
right?
Result:
bool bCtrlPressing = false;
On Key Down event: if Ctrl press then bCtrlPressing is true.
On Key Up event: if Ctrl up then bCtrolPressing is false
On Mouse Down:
if bCtrilPressing is true, add this control to the selecting list.
|
|
|
|
|
I have a notepad text file that looks like this:
xxxxixxxxxcxxxxxxxxixxxxt
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
25 across, 19 down...
And some code to read in the text file:
FileStream fs = File.OpenRead("maptest.txt");
StreamReader reader = new StreamReader(fs);
string x = string.Empty;
while (!reader.EndOfStream)
{
int y = reader.Read();
char z = (char) y;
if (z == 'x' || z == 'c' || z == 'i' || z == 't') x += z.ToString();
}
char[,] map = new char[25, 19];
int index = 0;
for (int row = 0; row < 25; row++)
{
for (int col = 0; col < 19; col++)
{
map[row, col] = x[index];
index++;
}
}
My array "char[,] map = new char[25, 19]" is meant to store x and y cords of each character ie to find the first instance of the character "i" I can get its by referencing "map[4,0]".
My text reader is wrong and I need some help to read in the values into the array
|
|
|
|
|
Actually, don't you want the array to be [19,25], as in 19 rows of 25 characters ?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hey Mark, why do all your posts get a 1 vote? Does someone here hate you?
|
|
|
|
|
Yes, there appears to be very childish people around here. What a surprise.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You have your columns and rows mixed up.
char[,] map = new char[25, 19];
int index = 0;
for (int row = 0; row < 19; row++)
{
for (int col = 0; col < 25; col++)
{
map[col, row] = x[index];
index++;
}
}
|
|
|
|
|
Thanks all works now
|
|
|
|
|
On an unrelated matter, why are you making a string that way?
You could use a StringBuilder, or even skip that step at all if you're only using it to fill the map (you could fill the map directly)
In this case it doesn't matter that much since the string is fairly short, but string concatenation inside a loop should generally be avoided..
|
|
|
|
|
If you create a custom collection by deriving from CollectionBase, is there an easy way to fire an event when one of the collection items is updated?
For example, any GUIs that care can subscribe to some sort of event that would be fired where an object that is a member of the collection is modified?
|
|
|
|
|
If you have created a custom class you can create whatever events make sense. For instance, in your override for the OnSet method fire off your custom event.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Not that I know of. There are two easy options.
1. If you are using .NET framework 3.5 then add a reference to WindowsBase to your project. You can then use System.Collections.ObjectModel.ObservableCollection<T> which has an event CollectionChanged which should do what you want.
2. Make your own generic class and implement ICollection<T> and possibly ICollection . You can simply wrap a List<T> in this class to make implementation easier. Now you have control over all items in/out of the collection so can raise custom events as you like.
[Edit]
I've just had a look at the CollectionBase class and you should be able to override the necessary methods as they are protected virtual and raise your own event(s).
OnClear, OnInsert, OnRemove, OnSet
All these also have a protected virtual OnxxxComplete method too.
[/Edit]
Dave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Sunday, March 21, 2010 10:09 AM
|
|
|
|
|
hello
can any one give me a sample code of
creating a function or procedure in oracle
and then use it to return a datatable with tableadapter
thank you
|
|
|
|
|
Here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|