|
hi ,
iwant to copy the row in the grid view how can i do it
|
|
|
|
|
Add the row to the Datasource of the grid view and update the bindings of Grid View.
|
|
|
|
|
hi ,
i have a image button in grid view i want to delete the records how can i get the id of the row to be deleted
|
|
|
|
|
Hi
I am trying out this code with the Paint and serial port,
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Paint += new PaintEventHandler(f1_paint);
}
it never runs on serial input, unless I set a break point at the function f1_paint, than it works! how do I make it work without having to set a breakpoint everytime I want it to do draw?
Thanks
Samuel
|
|
|
|
|
Two things wrong
1 - you add this method to the paint event over and over
2 - creating a paint handler does not fire it. Setting a breakpoint brings your IDE to the front, and when you hide it again, the paint event will fire. Invalidate() is the method to call to force a paint event. Do that here, and set up the event handler in your constructor or OnLoad event.
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 )
|
|
|
|
|
hi guys,
i'm working on the context menu for the controls.
the problem i'm facing right now is like this :
i want to use one context menu for more then one controls lets say i
want to use one context menu for 3 pictureboxes controls as 3 of them
shares same type of menu.
what i'm not able to do is, i can not identify which control has invoke
the context menu's event. how can I do dis???????/
|
|
|
|
|
Hi,
have a look at ContextMenu.SourceControl
|
|
|
|
|
I want to get the image null of that picturebox but cant get it using contextmenu.SourceControl.Image=null;
doesn't work any idea???????
|
|
|
|
|
Hi,
void contextMenu_Popup(object sender, EventArgs e) {
ContextMenu cm=(ContextMenu)sender;
Control cs=cm.SourceControl;
log("contextmenu sender="+cm);
log("contextmenu SourceControl="+cs);
...
SourceControl returns the CONTROL that is showing the ContextMenu;
you cannot get to its Image property, because a general Control doesnt have one.
You must cast it to a PictureBox if you want to perform PictureBox specific
operations.
PictureBox pb=cs as PictureBox;
if (pb!=null) pb.Image=null;
this would remove the image.
In future, dont post "cant" and "does not work" but provide specific information
such as "Compiler gives the following error: ..." or "Running the app gives
following Exception: ..."
|
|
|
|
|
I have setup a program with my DataSets in arrays
public static DataSet_PMI20[][][] dsPMI20 = new DataSet_PMI20[8][][];
with a table in the dataset would be
dsPMI20[8][5][20].PMIVar20
How do I setup a stored procedure to fill this dataset, do I need 40(8x5) different tables in SQL Server to feed this dataset. Have the SP loop through all of these tables to fill it. I am using Strongly Typed DataSets.
Some of the programs on this site write stored Procedures automatically, will any of these be of use, or any articles that you know of help. Is there a better way for me to do this.
Any ideas, I would appreciate any suggestions or help on setting this up.
Thanks in advance.
Michael
-- modified at 20:58 Thursday 21st June, 2007
|
|
|
|
|
Three Dimentional array of dataset. sounds like you have made it real complicated. Any special reason of doing it like this? Because if not there are easier solutions
|
|
|
|
|
I use the same methods, formulas, etc. to calculate data at different dimensions, therefore it was easier to set things up in a loop and just change the variable in the array. What are the alternative ways you are speaking of. I might be able to change my code to fit it possibly.
|
|
|
|
|
May be its just me but I have never used two\three dimentional dataset array as data access. In the data layer when you add dataset, you get all the tables through Stored procedure and combine them with relations in a dataset. You will have different Datasets according to your need and the relations in the Database.
This might not be what you are looking for. I am not sure what your requirement is. May be the way you are doing is the best for what has to be done.
|
|
|
|
|
I think what I will try is to use the data adaptors generated and place a for statement somewhere that changes the table name and loads the data from multiple tables. If that doesn't work I will try as I suggested earlier and have the SP loop through the tables. Maybe even setup differen data adaptors to do the job if necessary. Thanks for the thought.
|
|
|
|
|
Hello,
I just found out that, my editor made of rtb lags really bad when the number of lines is longer than 100 for example.
Could it be because im using the syntax highlighting textbox library to highlight syntax inside the editor?
Is it possible to increase the performance of it somehow so it doesnt lag ever sec as you type.
|
|
|
|
|
I am not surprised since a textbox is holding all its data in one string;
doing anything fancy to it does not scale well, it is at least quadratic:
when the text grows, so does the number of operations required, AND the cost
of each operation (creating a new string copying all the characters).
I see no easy way out; I did my own line-oriented text editor (with syntax
highlighting and everyting) in a plain Panel; and I do all screen-based logging
to a ListBox.
I am not a big fan of either TextBoxes or RichTextBoxes because
of their degrading performance. I only use them for short texts (say 50 lines),
and preferably texts that dont change.
|
|
|
|
|
How can i create a line-oriented text editor of my own with syntax highlighting ability?
|
|
|
|
|
If you are not happy with what you have, I can tell
you how I did it, but I must warn you, it has been
a big effort.
I did it as part of a larger project; relevant steps include:
- text lines stored in memory basically in an ArrayList,
one item per line;
- each line also holds two flags to indicate comment
status; these get set when the line is input/changed;
- text drawn in a Panel, using OnPaint handler,
and Graphics.DrawString;
- all coloring/syntax highlighting handled inside OnPaint,
based on a simple parser that knows the list of
keywords (and their color) for each of the supported
programming languages.
Steps taken to get maximum performance:
- only the visible lines are parsed, colored and painted;
lines scrolled outside the panel are skipped (except
for the comment flags).
A typical Panel shows up to 60 lines, a very small
number with respect to an entire source file.
- the comment flags help in starting the first visible
line either as continued comment (green background)
or not.
- the simple parsers are not full fledged parsers, they
dont understand expressions, dont return a parse tree,
etc. They must only process a single line and know about
comments, string literals, and keywords.
- the parsers return tokens (identifiers, constants,
operators, etc) as a string plus Color; Graphics.DrawString
paints these tokens individually.
- as a result of all this, nearly linear behavior, and no delay
whatsoever.
All in all a couple thousand lines of C# code (and
based on a growing library of low-level classes that
I use in all my apps and that is not included in the
estimate).
Hope this clarifies things.
|
|
|
|
|
Okay, somebody tell me the secret!!!
I need to check the ASCII value of a
single character in a string --
(value of a quote " or an equal sign =,
which is ascii 34 and 61 respectively)
I cannot figure out how this is done -- I've
been all over the map on this! I'm embarrassed
to say I am an experienced programmer (PLSQL and
VB6) C# is my first object oriented effort and
I am about to pull my hair out on what would seem
to be a simple task. Please, if anyone can show
an example of this, I'd truely be grateful.
Remember that I am a beginner and may not be
able to make leaps of logic as in "just use Char".
Thanks.
stone_sks
|
|
|
|
|
stone_sks wrote: "just use Char".
See? You know the answer already.
In what way do you want to "check the ASCII value"?
Will something as simple as if ( s [ 0 ] == 61 ) ... suffice?
|
|
|
|
|
Yes, it could be that simple.
What I am doing is parsing through a string
where I need to check each character's ASCII
value. But yes, it could be as simple as
your example inside a for loop. Thank you.
stone_sks
|
|
|
|
|
And Regular Expressions won't do what you need?
|
|
|
|
|
No, I need to check the value against the ASCII
chart, as in the following example (which is VB6 code)
c is value I will check.
Select Case Asc(c)
Case 13, 9, 10
sSql1 = sSql1 & " "
Case Is < 32
sSql1 = sSql1 & " "
Case 34
sSql1 = sSql1 & "'"
Case Is > 124
sSql1 = sSql1 & " "
Case Else
sSql1 = sSql1 & c
stone_sks
|
|
|
|
|
Well, as Luc pointed out, you can use character literals
switch ( c )
{
case '\t' :
case '\r' :
case '\n' : ... ; break ;
case '\"' : ... ; break ;
...
default : ... ; break ;
}
Although, that test for < 32 , is problematic.
But it looks like you're simply replacing non-printing characters with a SPACE, a QUOTE with an APOSTROPHE, and everything else left as it is; I expect that can be done with a Regular Expression.
|
|
|
|
|
PIEBALDconsult wrote: Although, that test for < 32, is problematic
well, not really, I would suggest:
if (c < ' ') ...
There is one, very structured, alternative using an array, that serves as
a translator; it does not rely on any knowledge about ASCII values !
char[] translatation=new translation[128];
translatation[(int)'a']='a';
translatation[(int)'b']='b';
translatation[(int)'\t']=' ';
etc
then:
foreach (char cin in inputCollection) {
char cout=0;
if (cin<translation.Length) cout=translation[(int)cin];
if (cout!=0) stringbuilder.Append(cout);
}
of course the initialization can be shortened by using a foreach loop as in
foreach (char c in "abcd....") translation[(int)c]=c;
|
|
|
|