adding user control to a cell in a DataGridView

Instead of one of the existing column types I would like to have a user 
control appear in a cell in a gridview.

What I have done is created a control
CCTest : Control, IDataGridViewEditingControl
inherits from Control, and implements IDataGridViewEditingControl

I then create a cell class
TestCell : DataGridViewCell

in here I override  public override void InitializeEditingControl(int 
rowIndex, object
            initialFormattedValue, DataGridViewCellStyle 
dataGridViewCellStyle)

to set the editing control for the cell.

these get used in a column I create and add to the datagridview.


The problem I have is that I want the editing control to be the control that 
appears when the user first opens the form.

In my test cell class I overrode Paint to do this.
In here I create an instance of the custom control I want to appear.
Then I use.
tst.DrawToBitmap(bmp,new Rectangle(0,0,90,90));
            graphics.DrawImage(bmp, cellBounds);
where tst is the instance of the control I created.

This works.  However I was just curious as to if anyone has a better way to 
do this.
I'm not really a fan of the solution I came up with.

Thanks in advance

Ralph




 

0
Ralph
4/15/2010 12:34:50 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

0 Replies
1185 Views

Similar Articles

[PageSpeed] 37

Reply:

Similar Artilces:

Cell refering filename in formula bar
How do you refer filename1 to a cell in the formula bar? Example: ='\\Year 2004\September\[_filename1_.xls]sheet1'!$A$1 A | B | C 1 | | 2 | filename1 | 3 | | 4 | | ="\\Year 2004\September\["_B2_".xls]sheet1'!$A$1 will not work -- yee ve ----------------------------------------------------------------------- yee ven's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1479 View this thread: http://www.excel...

Adding hyperlinks with parameters
Hey everybody I have a batch file which needs to be run from an excel sheet with a parameter, like this: c:\1.bat myParameter But when i try to run the Hyperlink, the Excel shows an error message saying it can't open the specified file (probably because the is a space between the file and the parameter) is there any known way to run the link from the excel? On Mar 2, 12:45=A0pm, Pasha <pavel_v...@mailto.mod.gov.il> wrote: > Hey everybody > I have a batch file which needs to be run from an excel sheet with a > parameter, like this: > c:\1.bat myParameter > But when i ...

Adding Blank Rows after the last Detail of the Report
Hi All, I've used this code from Dwayne: Private Sub Report_Page() Dim intNumLines As Integer Dim intLineNumber As Integer Dim intTopMargin As Integer Dim ctl As Control Dim intLineHeight As Integer intNumLines = 12 intTopMargin = Me.Section(3).Height intLineHeight = Me.Section(0).Height For Each ctl In Me.Section(0).Controls For intLineNumber = 0 To intNumLines - 1 Me.Line (ctl.Left, intTopMargin + _ (intLineNumber * intLineHeight)) - _ Step(ctl.Width, intLineHeight), , B Next Next End Sub My report needs to print blank rows (at least...

Newbie question on Admin vs Developer vs Power User
I'm learning Sharepoing/Moss now and there seems to be a definite distinction in all the course materials between Administrators/Developers/Power Users They seem to make a big point about identifying 'power users' in different sections of the work environment to handle a lot of the stuff, but then again, all the tasks seem to blur from one role to the other - and, if you gave enough of the tasks over to the 'Power users', as they call them, it seems to take away from the other roles. Now, maybe I've never worked in a business enterprise that's big enoug...

outlook vcard, ad integration user properties
my boss is trying to get hix fax# in his vcard. he is using his address from the global address list I have modified his profile in active directory users and computers: I go into AD users and computers, double click on his user, go to the telephones tab, and enter his fax #. but when I did this his fax # is still not being pulled up in his outlook vcard. Does anyone know where outlook is trying to get this field from / how i can get this field into his vcard? thx ...

Deleted User, Lost License
I accidentally deleted a user from Active Directory prior to removing their CRM license, and now CRM will not let me remove the license for that user because the user no longer exists. Anyone know how I can reclaim the orphaned license? Thanks, -Jeff Hi Jeff One solution is this: -Open Deployment Manager and go to License Manager -Remove your CRM License -Add you CRM License back -Open CRM and assign License to all users who need them Regards Dan "JeffW" wrote: > I accidentally deleted a user from Active Directory prior to removing their > CRM license, and now CRM w...

VBA pick random cell
hi, i want to pick a random cell (containing text) in a given range. i used the "randbetween" function in excel, but i am now needing thi in visual basic. i found the following vba snipplet, but i don�t understand it, an can�t implement it in my code: PHP code ------------------- With Range("B1") .FormulaR1C1 = _ "=OFFSET(Sheet1!RC[-1],RANDBETWEEN(0,9),0)" ------------------- it would be great if someone could give me an example of picking random cell in the range lets say ("A1:B10") i would also like to know how to combine two ra...

Multiple Users
Let's say I buy merchandise for 1 department. I have dozens of users (for different departments), who import data (using a form) from 1 source database (in which they do not see). Upon importing the source data (their department info), they manipulate it, then delete the relevant old data in the source, and replace it with the newly manipulated data. My question is: Is there any chance of data deletion with multiple users hitting the source at the same time? Meaning, if I am only deleting and replacing MY department, it shouldn't affect other data in the table? We&...

ADDING A NUMBER
how do i add a number to a range of cells? I need to add 11.27 to a number of different cells each with a different number in them Put 11.27 in an empty cell, format it the same way as the numbers you want to add to, copy it, then select the numbers you want to add to and do edit>paste special and select add. -- Regards, Peo Sjoblom "Helpme" <Helpme@discussions.microsoft.com> wrote in message news:6D51344A-78E6-4377-B292-FC6C16FF6BA2@microsoft.com... > how do i add a number to a range of cells? I need to add 11.27 to a > number > of different cells e...

adding new records
I am totally new to CRM, so I hope this is really easy question: This concerns permissions.. I have a "sales" group, and with one of those people i need to be able to let them add new records on behalf of other "sales" people. Is there like a standard permission setting for it? (obviously every "sales" person can add new records if they select them selfs as the owner) thanks, Michal. Hi, By default the person who creates the record will be the owner. After record creation the person could reassign the record (manually) to another user. If all rec...

click on a cell to expand with more information
I am making a phone contact record for work. How can I make a cell (with a customers name in it) expose more details or information about that customer, when hovered over with the pointer? I also need to know how to enter the information to be viewed. 2nd question - How do I create a line between multiple entries for the same customer and the next customer? example: John Doe 05/05/05 123-456-7891 9:00 left message John Doe 05/08/05 123-456-7891 9:30 left message John Doe 05/08/05 123-456-7891 10:00 returned call _____________...

When adding attachments...
....in Outlook the following errors comes up: "Out of memory or system resources, please close some programs and try again" Quotas are fine. I have deinstalled/reinstalled Office, cleaned 'temp' areas, and many other tidbits. Any other ideas? Thanks. This might help as i had this problem with Outlook 98. Is the file you are trying to copy to attach nested in sub folders? if so try and copy the attachment to a root drive like c:\ Ignore previous email. wrong spellin if the attachment is nested in sub folders(this means you have to open different folders to get to ...

Count cells that Contain text
Is there a way in excel to count the number of cells in a colum tha contain a specific piece of text, e.g. "ACT" I know that I can use the countif or sumproduct functions to coun cells which *only* contain "ACT" but I need to count the number o cells in a column which countain ACT but may also contain other text a well. You can manually do it using autofilters but I need to count it using formula. Any help would be greatly appreciated. Ta And -- Message posted from http://www.ExcelForum.com =COUNTIF(Range,"*ACT*") -- Regards, Peo Sjoblom (No private...

Error when add New User #2
Hi, dont know when it happened. When I add new user to production MSCRM 4, there is an error message (An error Has occurred.....). However, when I try to add this user to my test CRM, it can successfully add without any problem. Both servers are running the same spec and version. I tried to add different users to production but all failed. I have set the deverror to ON but the error message still appear as An error has occurs. Apart from that, I have used CRM diagostic Tool but cannot see anything unusual from the log. I have even run the repair but effort is all wasted. Please He...

Using multicell range when single cell prescribed
This is unusual (to me) range usage. It is NOT entered as array formula. A1=123 A2=456 B1=left(A1:A10,1) B2=left(A1:A10,1) Note the results. Additional observations - you can stick dollar signs on 1 and 10: no result change. You can (instead) copy B1 to B2: no result change. It's as though using a range where you "ought" to be using a single cell [range] is interpreted as "the cell for column A of current row" (for this choice of A1:A10).However note that B1=left(A2:A10,1) gives #VALUE. Is this a beneficial (and reliable) tactic in some situations, for some worksheet...

Picture Disappears When Added To Contact In Outlook 2003
Can someone help please. When I try to attach a picture to a contact in outlook 2003 immediately I double click the picture to be attached it disappears out of the outlook contact along with the placement holder in the form. Only when I right click the mouse and go remove picture do I get the placement holder back. I have looked at all the help menus but they offer no clues. Thanks TS ...

create a new worksheet when a cell has a date entered
I am trying to create a new worksheet when a cell has a date entered into it For instant in Worksheet 1 you type into cell B11 a date I would like to automaticly create a new worksheet and call it that date entered to B11 Then if I type a Date into cell B12 a new worksheet would be created and named the date entered into B12 and so on Is this out of the question See response in your other post. "Zane" wrote: > I am trying to create a new worksheet when a cell has a date entered > into it > > For instant in Worksheet 1 you type into cell B11 a date > I would l...

Moving User from Exchange 5.5 to Exchange 2003
I built an exchange 2003 server on win3k platform and it is coexisting with exchange 5.5. i also moved few users from 5.5 to 2003. Now i am moving a user who has a big mailbox 796,269kb. its been running 1 horu and 48 min. from past 30 min it is saying "saving changes to the directory". and its 100%. can any one tell me is it normal or its an indication of a problem. thanks -- Curious MCSE, CCNP Curious wrote: > I built an exchange 2003 server on win3k platform and it is coexisting with > exchange 5.5. i also moved few users from 5.5 to 2003. Now i am moving a > use...

Money 2004 Deluxe and multiple network users
Is MS Money 2005 now "network aware"? In other words, can I set up a money file so that two users can access it across a home network without worrying about whether or not the other user is already in the file, thus causing corruption? I did a quick test which would suggest yes, but I want to triple check. Here's what I did: 1. Copied my money file to a safe location 2. Opened it on one computer (A) 3. Walked to another computer (B), opened it there as well 4. Opened A to Home page. 5. Opened B to Home page, then went to downloaded statements and accepted some transaction. 6. O...

merging cells #3
Hi, I got an Excel file from a friend where I combined two columns, area code and phone number. Everything works in Excel, except that the rows and column lines are grey and not black. Outlook does not see the new column. What could be the problem? Thanks AJS Solved it. "AJS" <newsgroup@sorga.com> wrote in message news:%232OPgj%23dJHA.4900@TK2MSFTNGP06.phx.gbl... | Hi, | I got an Excel file from a friend where I combined two columns, area code | and phone number. | Everything works in Excel, except that the rows and column lines are | grey and not black. | Outlook does n...

Adding ActiveX to dialog with wrapper
When I add an ActiveX object to a dialog using the dialog editor - right click - insert activeX object, the help on the resulting activex selection tool states that a wrapper will not be added by using this method. If you need a wrapper, it suggests using the class view. This is using Visual Studio 2005. I'm having some problems with this on an existing project. To make sure I understand the process, I created a new MFC project, added a dialog, created a class for that dialog and added a Flexgrid object using the right click method in the dialog. I then added a variable for the flexgrid...

Money cannot creare a temporary file in 'C:\Documents and Settings\[USER]\Local Settings\Temp'
Hi, I just started to get this kind of error message when I make bakups with my Money 2003 Deluxe: "Money cannot creare a temporary file in 'C:\Documents and Settings\[USER]\Local Settings\Temp'". I checked the folder mentioned and my WinXP user account has the privilges on that folder (as it is supposed to have). How I can solve it? Thank in advance. Di Fresco Marco > I just started to get this kind of error message when I make bakups with my > Money 2003 Deluxe: > "Money cannot creare a temporary file in 'C:\Documents and > Settings\[USER]\Local...

Adding alternate columns
I work on a schedule where I record ticket count and ticket sales for each show, listed chronologically. Column A = week ending date Column B = # Tickets sold for April 5 show Column C = Ticket Revenue for April 5 show Column D = # Tickets sold for April 9 show Column E = Ticket Revenue for April 9 show Column F = # Tickets sold for April 12 show Column G = Ticket Revenue for April 12 show Column H = Total # Tickets sold for all shows Column I = Total Ticket Revenue for all shows In the Totals columns, the Total Tickets formula is "+B4+D4+F4", and the Total Revenue f...

Change License Key
Helllo, I´ve the following problem: On my server runs MS CRM 3.0 with a trail license key. The license has expired now. But I cant change the license because I´ve 21 users in the system, but only 20 licenses... How can I solve this problem? greetings, Stefan disabling a user will remove a user license. "Stefan" <Stefan@discussions.microsoft.com> wrote in message news:4500CF02-65FD-46F8-B3B0-7A80A5B89005@microsoft.com... > Helllo, > > I�ve the following problem: > On my server runs MS CRM 3.0 with a trail license key. > The license has expired now...

Adding more than three Conditions to 'Conditional Formatting'
Can i add more than three conditions to the conditional formatting presets using code? Regards [Riz] -- Rizitsu ------------------------------------------------------------------------ Rizitsu's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15840 View this thread: http://www.excelforum.com/showthread.php?threadid=320382 Riz, as you have found out, only 3 conditions with conditional formatting. But yes you can use some code to get more than 3, try this it will change the cell color in column A when you put in one ,two, three, or four, right click on the she...