|
Hi all,
Ok, I have a datagrid, the user can input data. I want something which will prevent them to edit
previously created rows.
Can someone give me some suggestions.
Thanx in advance
|
|
|
|
|
Ok I figured out something which works, could someone let me know of any other ways??
<br />
private void table_RowChanged(object sender, DataRowChangeEventArgs e)<br />
{<br />
lastRow++;<br />
}<br />
private void datagrid_CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
if( datagrid.CurrentCell.RowNumber != lastRow )<br />
{<br />
datagrid.CurrentRowIndex = lastRow;<br />
}<br />
}<br />
|
|
|
|
|
Hi,
Is there a way how to disable selecting mechanism of a DataGridView at all? It brings me a lot of workaround... Simply I don't want user to select anything, neither rows, columns or cells.
thank you
zilo
|
|
|
|
|
|
|
That would solve your problem. You can still see the data, but you can't select. Isn't that what you want?
|
|
|
|
|
I need to disable selecting anything, however I still need to use all controls (button's, checkboxes,etc...)
|
|
|
|
|
Buttons and checkboxes inside the grid, you mean?
|
|
|
|
|
|
Perhaps another possibility, is listen for selection changed event, and when it happens, ensure that 0 rows are selected.
|
|
|
|
|
Hy
I'm writing text in a richTextBox and I want to find the position of the cursor, not the mouse cursor.
Can you help me.
Thanks
|
|
|
|
|
hi
int pos = richTextBox.SelectionStart;
regards
|
|
|
|
|
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public external uint SendMessage(IntPtr hwnd, uint command, int arg1, int arg2)
public class Example : Form {
...
private RichTextBox rtb = new RichTextBox();
// EM_POSFROMCHAR = 0xD6
uint pos = SendMessage(rtb.Handle, EM_POSFROMCHAR, 0, rtb.SelectionStart);
...
}
I think this method returns an int of the form (x << 16) + y, but you should look it up to be sure. I have not written this in the compiler and am only going from memory, so you need to check to make sure that this works, but the idea is the same. Anyway, I thought that rtb's have a method called "GetCharPos" or something like that... Hope this helps.
Jeff
|
|
|
|
|
I create a dataset nd fill it from the an adapter
now i want to fill the datagridview and color each row with different color
any help?
Thanks in advance
Assaf
|
|
|
|
|
1) either set the DataSource property of the GridView to your Dataet or (better) use an DataSource approach (see MSDN for that).
2) register the RowBound event of the GridView
3) set CssClass of row depending on your data
4) write the CSS styles
by the way: MSDN would have been a good source of information, too.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
can you claify your answer please
Thanks
Assaf
|
|
|
|
|
I think I gave you enough buzz words to go to google or the msdn and find the details of your own.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
for coloring each row ???
but i didn't saw this idea before !
I'll seach for this anyway ???
Thanks
Assaf
|
|
|
|
|
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.CssClass =
}
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Can anyone point me in the direction of some examples of the implementation of the Intel UPnP SDK. According to a post I found Intel haven't released any documentation about it because they consider it to be a support DLL and nothing more.
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
Hi,
I need to create and Ms-Word addin that will add a footer to all the pages of an open document. I have browsed and got some code.
I have referred MS knowledgebase article and have created an addin, but that code is not adding any button to the commandbar of Word. It did one for outlook. When I made some changes to the code to make it word specific, it still didn't do anything. I have written the following code in OnStartupComplete method:
object oMissing=System.Reflection.Missing.Value;
CommandBars cmdBar = wordApp.ActiveDocument.CommandBars;
try
{
this.myButton = (CommandBarButton)cmdBar["Tools"].Controls.Add(1, oMissing, oMissing, oMissing, oMissing);
}
catch
{
this.myButton = (CommandBarButton)cmdBar["Tools"].Controls.Add(MsoControlType.msoControlButton, oMissing, oMissing, oMissing, oMissing);
this.myButton.Caption ="Hello";
this.myButton.Style=MsoButtonStyle.msoButtonCaption;
}
this.myButton.Tag ="Hello Butom";
this.myButton.OnAction="MyAddin1.Connect";
this.myButton.Visible =true;
this.myButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.myButton_Click);
But this is not working. I am also not able to debug it.
Please help!!!!
|
|
|
|
|
I have been reading a lot lately about how Interfaces and abstract classes are hallmarks of good C# programming. I admit, they are interesting, but my understanding is very limited as to why one would use either instead of simply creating a reusable class.
I have been programming for a long time, but have never needed either, but I will be the first to admit that much of my code in the past could have been done better.
SoI guess my question is, what circumstances would I use either an interface or an abstract class, and why would this benefit me?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
1) A class in c# can derive from one class and can implement as many interfaces as it wants.
2) an abstract class contains abstract methods and normally at least one non-abstract method. They are used if there exists a common behaviour (non-abstract methods) and methods that can only be implemented by derived classes (abstract methods).
3) interfaces are used to define an Interface that means it describes what some object can do.
4) you can look at an interface as a class containing only abstract methods
5) because you can not have multiple inheritance in c#, interfaces are used instead.
A good object oriented base idea is that you always program against an interface and never against a class. This simplifies loose coupling of components a lot as well as it allows the replacement of an instance implementing a certain interface with another (good in testing with mocks for example) or if your code has several strategies to handle something that can be exchanged (strategy pattern).
I'm stopping now, it's going loooong.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
So, essentially, they are there to make things easier and cleaner (kind of like XHTML), it isnt really ever necesarry, but is, as a rulle, good practice. Right?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
If you want, then yes.
But necessary is only machine code, everything else is to make things easier and cleaner:
- assembler
- IL
- C#
- interface, classes
- patterns
-- modified at 9:36 Wednesday 5th September, 2007
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|