Hi All, I did raise this question yesterday also, but its not showing up in the message board, thus pasting it again. I have a DataGridView where in I am trying to add DataGridViewComboBoxColumn. Though the column is getting added but the combobox is empty. DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); cell.Items.Add("One"); cell.Items.Add("Two"); cell.Items.Add("Three"); DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn(); column.HeaderText = "SELECT"; column.Name = "ItemSelect"; column.CellTemplate = cell; column.DropDownWidth = 160; column.Width = 90; column.MaxDropDownItems = 3; column.FlatStyle = FlatStyle.Flat; column.ReadOnly = true; //column.Items.AddRange("One", "Two", "Three"); -- I tried this way too myDataGridView.Columns.Insert(0, column);
After displaying the values which event I should handle to get the selected value in combobox? Thanks in Advance
sachinkalse
Posts
-
DataGridViewComboBoxColumn not showing values -
DataGridViewComboBoxColumn not showing the contentsHi I am trying to insert a DataGridViewComboBoxColumn, the column is getting inserted but without values (options) in the combobox. The Code is as under
DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn(); column.HeaderText = "SELECT"; column.Name = "ItemSelect"; column.CellTemplate = new DataGridViewComboBoxCell(); column.Items.AddRange("One", "Two", "Three"); column.DropDownWidth = 160; column.Width = 90; column.MaxDropDownItems = 3; column.FlatStyle = FlatStyle.Flat; myDataViewGrid.Columns.Insert(0, column);
When I run the code, in datagridview all cells except 1st are populated properly, in first cell I see only empty combobox. Also, after showing the value, which event should I use to get the selected value of combobox? Please guide Thanks in advance -
DataGridViewComboBoxColumn not showing the contentsHi I am trying to insert a DataGridViewComboBoxColumn, the column is getting inserted but the values in the combo box are shown. The Code is as under
DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn(); column.HeaderText = "SELECT"; column.Name = "ItemSelect"; column.CellTemplate = new DataGridViewComboBoxCell(); //column.DataSource = new string[] { "One", "Two", "Three" }; column.Items.AddRange(new string[] { "One", "One", "Three" }); column.DropDownWidth = 160; column.Width = 90; column.MaxDropDownItems = 3; column.FlatStyle = FlatStyle.Flat; myDataViewGrid.Columns.Insert(0, column);
When I run the code, the dataviewgrid all cells except 1st are populated properly, but in first cell I see only empty combobox Please guide Thanks in advance -
Web application in Visual Studio 2008Pardon me if this is not the correct place to ask following question. In visual studion I guess there are two ways to create a web application 1st : File -> New -> Web Site and 2nd : File -> New -> Project -> Visual C# -> ASP.Net Web Application I wonder what is the difference between the two. I found one, when I add crystal report file to fist one I can not see the .cs file for the same. Please guide
-
System.Runtime.InteropServices.COMException (0x800A1401) [modified]dear all, with trial and error, I found a work around for this. I don't know if its correct or not, but pesting it for your reference. Start - Run - type "dcomcnfg.exe" click ok It will open Component Services Under - Console Root -- Component Services --- Computers ---- My Computer ----- DCOM Config Open the properties of following - Microsoft Excel Application - Microsoft Office PowerPoint Slide - Microsoft Office Word 97 - 2003 Document Go to Identity tab Select "This User" and add 'system admin' credentials In my case same system admin is used in the identity of application pool in IIS :-D
-
System.Runtime.InteropServices.COMException (0x800A1401) [modified]Dear All, Please help me solving following issue. Background Information ------------------------------------ 1. We have 2 web application running on MOSS + IIS 6 2. Both applications are on same web server, run by System Admin account 3. Developed using ASP.Net, C# and DB as SQL Server 2005 4. One is running on Framework 2.0 and second is on Framework 3.5 5. In both we are using Office Objects to impose IRM permissions 6. Both were working till latest windows update on the web server. 7. After that we started getting following errors Errors --------- Word object: Not Able to Open the word file at all ------------------ System.Runtime.InteropServices.COMException (0x800A1401): Word experienced an error trying to open the file. Try these suggestions. * Check the file permissions for the document or drive. * Make sure there is sufficient free memory and disk space. * Open the file with the Text Recovery converter. (C:\...\My File.doc) at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform) at OpenFile.SetExpiryDate(String strFilePath, String strExpiryDate) in c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\My Application\MyPage.aspx.cs:line 1033 Excel Object: Not Able Close the excel file even though all objects are explicitly closed. ------------------- When try to delete file following error comes. The process cannot access the file 'C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\My Application\\Scratchpad\\Book1.xlsx' because it is being used by another process PowerPoint object: Not able to save --------------------------- Presentation (unknown member) : An error occurred while PowerPoint was saving the file. Is this some kind of a security permission issue on the folder where we are processing the file? Right now I have given full permission to following accounts. 1. Administrators 2. ASP.Net 3. Network Service 4. System After the error I gave full permission to Everyone, still the problem persists. I have uninstalled office and inst
-
IE 7 Restart problem in Vista machineSorry for being vague. It crrashes at any moment at any page before debug (stepped through). As I have written in first message, there is no error at all. In all cases it just reboots IE. More over all users have access permission.
-
IE 7 Restart problem in Vista machineDear All, We have two (ASP.net) web applications running on Windows Server 2003. First application runs on Framework 2.0 and the second one runs on Framework 3.5. Most of the client machines are having Vista and we are facing a strange problem, i.e. IE7 restarts very frequently. There is no error logged or displayed and the pattern is also not consistant. IE gets restarted at any page and next time it works well at the same page. This problem occurs on Vista + IE7 environment only. Please guide.
-
Fetching meta data of MS Office files [modified]We are trying to fetch Author, Company Name and Creation Date of MS Office Files (.doc, .docx, .xls, .xlsx, .ppt, .pptx) using following code
protected void Page_Load(object sender, EventArgs e) { string strFileName = string.Empty; strFileName = @"D:\My File.pptx"; DSOFile.SummaryProperties DSOSummaryProperties; DSOFile.OleDocumentPropertiesClass OleFile; OleFile = new OleDocumentPropertiesClass(); OleFile.Open(strFileName, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess); DSOSummaryProperties = OleFile.SummaryProperties; Response.Write("Author : " + DSOSummaryProperties.Author); Response.Write(" Company : " + DSOSummaryProperties.Company); Response.Write(" Date Created : " + DSOSummaryProperties.DateCreated); OleFile.Close(false); }
This works well in many conditions except stated below 1. If we try to rename .docx as .doc or .xlsx as .xls or .pptx as .ppt In this situation no data is fetched, but no error too 2. When file is created like, Right Click in any drive -> New -> New Microsoft Office Word Document.docx or New Microsoft Office Excel Worksheet.xlsx or New Microsoft Office PowerPoint Presentation.pptx In this case while opening the file following error is generated Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) Please guide, if any one knows the reason behind. More over how to fetch meta data of .xps files?modified on Thursday, April 17, 2008 4:06 AM
-
How to set Expiry Date to .ppt/.pptx files [modified]Dear All We have been struggling to set expiry date to power point files with following code. Though there is no syntactical error in it, it fails to set expiry date for given file.
Microsoft.Office.Interop.PowerPoint.Presentation presentation; Microsoft.Office.Interop.PowerPoint.ApplicationClass oPPT = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); presentation = oPPT.Presentations.Open(pptFileName.ToString(), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse); presentation.Application.Activate(); presentation.Permission.Enabled = true; presentation.Permission.Add("real_alias@real_site.com", MsoPermission.msoPermissionRead, dtExpireDate); presentation.Close(); presentation = null; oPPT = null;
We have done similar thing with excel and word files successfully and still are clueless for doing the same to Infopath file. Please guide Regards Sachinmodified on Sunday, December 09, 2007 9:00:07 PM
-
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.Dear All, I have a web application (ASP.NET / framework 2.0 / Windows Server 2003) on one machine, i.e. Web Server and corresponding database (SQL Server 2005) on second machine. If I access the application from Web Server, it works fine, but when I access from a third client machine it gives following error ------------------------------------------------------- Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. ------------------------------------------------------- I think this has some thing to do with the permissions to access DB from client machines my Web.config file has following things added --------------------------------------------------------- ..... ..... --------------------------------------------------------- Moreover, the SQL Server is configured as per following link "http://support.microsoft.com/kb/914277" Please guide Regards Sachin
-
How to impose expiry date to various documents using C#Thanks for the reply Dave, Well, I got some clue from MOSS ECM Starter Kit, where they have given some information about custom IRM protector. If I get anything concrete out of it, will definitely share. If any one has already done some work on it, please do share. Regards Sachin
-
How to impose expiry date to various documents using C#Thanks for your reply. But I think its possible, as its already done by one vendor of our client, since its their IP, we do not have access to the source code. That DLL imposes all IRM rights that includes expiry date too. Regards Sachin
-
How to impose expiry date to various documents using C#Dear All, Please guide me about imposing Expiry date to MS Office files (.doc, .docx, .xls, .xlsx, .ppt, .pptx, InfoPath) using C#, such that if the file has expiry date today, it should not open tomorrow. I know, we can do it if the IRM client is installed on client machine, but to avoid burden on the user we are told to do it through code. Regards Sachin
-
How to impose Expire Date on MS Office files? [modified]Maco can be disabled while opening the document, thus will not be useful. We were trying to add permissions to the file ojbetcs directoy using following code but that is giving very generalized exception "Value does not fall within the expected range" Please have a look at the code below ------------------------------------------
using System; using System.Collections.Generic; using System.Text; using Microsoft.Office.Core; using ExcelInterop = Microsoft.Office.Interop.Excel; using Microsoft.Office.Interop.Word; class Program { private void ImposeExpiryDate() { //For Excel ExcelInterop.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass (); ExcelInterop.WorkbookClass workBook = (ExcelInterop.WorkbookClass)excel.Workbooks.Open( "c:\\test.xls", 0, true, 5, "" , "", true, ExcelInterop. XlPlatform .xlWindows, "\t", false, false , 0, true, 1, 0); ExcelInterop.Sheets sheets = workBook.Worksheets; DateTime dtExpirationDate = DateTime.Today.AddDays(2); try { workBook.Permission.Add(@"sachin@abc.com" ,Microsoft.Office.Core.MsoPermission.msoPermissionFullControl, dtExpirationDate); } catch (Exception EX) { // "Value does not fall within the expected range" ??? } //For Word // Microsoft.Office.Interop.Word.ApplicationClass WordApp = // new Microsoft.Office.Interop.Word. ApplicationClass (); // Microsoft.Office.Interop.Word.Document aDoc = // WordApp.Documents.Open(ref fileName, ref missing, // ref readOnly, ref missing, ref missing, ref missing, // ref missing, ref missing, ref missing, ref missing, // ref missing, ref isVisible); // aDoc.Permission.Add // ("sachin@abc.com" , // Microsoft.Office.Core.MsoPermission.msoPermissionFullControl, // dtExpirationDate); } }
Regards Sachin -
How to impose Expire Date on MS Office files? [modified]I am using Document Library in MOSS to store MS Office files to make use of IRM in MOSS. (Web application) I want to impose expire date at document level before uploading to document library such that even if the document is downloaded on client machine, after expiry date, the document should not open. Thus, is there any way to impose expire date on MS office files (excel/word/power point/ infopath) using C#?:^) Please guide. -- modified at 22:21 Wednesday 13th June, 2007 Regards Sachin
-
TreeView display problemI have an ASP.Net application that uses IE Web Controls and has following problem; Windows Server 2003 (Service Pack 1)as a client does not display (IEWebControl) tree view, if SP1 is removed it works well. Please guide how to deal with this situation. :)
-
SQL Server Database dump to ExcelCan any one guide me about exporting entire database (and not a single table) in SQL server in to Micrisoft Excel 97-2000 and vise versa ? Similar to DTS Import/Export Wizard in SQL Server Enterprise Manager. Well, I want to do this in C# :) warn regards Sachin -- modified at 4:16 Tuesday 7th March, 2006
-
small project on c#hi check out this link for Printing in C# ; its good to begin with http://www.ondotnet.com/pub/a/dotnet/2002/06/24/printing.html[^] all the best :-D
-
Printing ProblemI have a small printing application (using PrintDocument class). I have several Printer Drivers installed on my comp, but when I physically disconnect any printer and try to Print anything, the application abruptly terminates. Can any one guide please?