Search Results

Search found 3559 results on 143 pages for 'winforms interop'.

Page 3/143 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • VBA to C# - Porting Userforms to Winforms?

    - by John M
    I am porting a Excel-VBA based app which uses Userforms over to a C# Winforms application. How do I convert the Height and Width of the VBA-Userform to the same screen dimensions in the C#-Winforms application? Is there a ratio that can use be used? Currently the VBA-Userform has a dimension of 179.25 W x 245.25 H which is optimized for use on a quarter-VGA device.

    Read the article

  • PowerPoint record slide show function accessible through Interop with C#

    - by dwperrin
    I am currently trying to write an addin for PowerPoint that whenever any PowerPoint document is opened and then run in show mode that the feature to record narration audio and slide timings is automatically activated. However I cannot seem to find that option in the PowerPoint interop object The manual in application way to use this feature in Powerpoint 2007 is under the "Slide Show" tab of the ribbon called "Record Narration". I have found under that I can set under Microsoft.Office.Interop.PowerPoint.SlideShowSettings.AdvancedSettings to RehearseNewTimings but this does not record narration audio. Does anyone know if this is even possible? Or if I am completely on the wrong track here. Thanks in advance for any repsonse

    Read the article

  • Gotchas of moving from developing ASP.NET to Winforms apps

    - by Peanut
    Hi, After developing ASP.NET apps exclusively for several years I'm about to start developing Winforms apps. What are the gotchas that I should be looking out for with this changes? For instance the way object lifetime is managed in the winforms paradigm. I'm sure there must be plenty of gotchas / differences between the two that I need to be mindful of. Thanks.

    Read the article

  • Is .NET support for Win32 Code Interop?

    - by Usman
    Hello, I need to InterOp Win32 code (unmanaged Win32 DLL's and Exe) completely with .NET. I need to call Win32 unmanaged code(DLL exported functions) at runtime i.e (knowing the types of data types in Win32 signatures and need to pass data according to that type at runtime). This is 100% possible in case of COM. You can convert COM unmanaged code to managed assemblies using tlbimp.exe and use now reflection API to work with those managed types(actual were unmanaged types now converted managed using tlbimp). But same functionality I need to get in terms of Win32(i.e) in .NET framework. How?? I know MS provided Export table reading API ..but I couldn't find exact API for InterOp of Win32 unmanaged code Regards

    Read the article

  • c#-excel interop - create chart on workbook as opposed to in a sheet

    - by david.barkhuizen
    Using c# MS Excel interop library, I would like to programmatically create a new chart on the workbook, as opposed to on an a sheet. The code below allows me to create a chart on an existing _Worksheet (sheet). using using Microsoft.Office.Interop.Excel; _Worksheet sheet; (assume this is a reference to a valid _Worksheet object) ChartObjects charts = (ChartObjects)sheet.ChartObjects(Type.Missing); ChartObject chartObject = (ChartObject)charts.Add(10, 80, 300, 250); Chart chart = chartObject.Chart; chart.ChartType = XlChartType.xlXYScatter; Does anyone know how to rather go about creating a chart on the workbook (i.e. where the chart is the sheet).

    Read the article

  • Help using the Office Interop for Word and Outlook 2007 in VB.NET

    - by vhorsen
    I need to start utilizing the interop in my programs to automate several functions in Word and Outlook and I was checking if anyone knew a good place to start. My ultimate goal is for my program to kick off a mail merge, create several different files and save them accordingly, then e-mail the different files to different people based upon who needs what. So any help on learning how to use the interop properly would be greatly appreciated. I am currently using Visual Studio 2008 and Office 2007 and use vb.net to write my programs. Thank you in advance.

    Read the article

  • .Net - interop assemblies taking 15 seconds to load when being referenced in a function

    - by Jon
    This is a C# console application. I have a function that does something like this: static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } That's all it does. When it is called there is a fifteen second delay before the function gets hit. I added something like this: static void MyAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args) { Console.WriteLine(DateTime.Now.ToString() + " ASSEMBLY LOADED: " + args.LoadedAssembly.FullName); Console.WriteLine(); } This gets fired telling me that my interop assemblies have been loaded about 10 milliseconds before my foo function gets hit. What can I do about this? The program needs to call this function (and eventually do something else) once and then exit so I need for these assemblies to be cached or something. Ideas?

    Read the article

  • Setting System.Drawing.Color through .NET COM Interop

    - by Maxim
    I am trying to use Aspose.Words library through COM Interop. There is one critical problem: I cannot set color. It is supposed to work by assigning to DocumentBuilder.Font.Color, but when I try to do it I get OLE error 0x80131509. My problem is pretty much like this one: http://bit.ly/cuvWfc update: Code Sample: from win32com.client import Dispatch Doc = Dispatch("Aspose.Words.Document") Builder = Dispatch("Aspose.Words.DocumentBuilder") Builder.Document = Doc print Builder.Font.Size print Builder.Font.Color Result: 12.0 Traceback (most recent call last): File "aaa.py", line 6, in <module> print Builder.Font.Color File "D:\Python26\lib\site-packages\win32com\client\dynamic.py", line 501, in __getattr__ ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1) pywintypes.com_error: (-2146233079, 'OLE error 0x80131509', None, None) Using something like Font.Color = 0xff0000 fails with same error message While this code works ok: using Aspose.Words; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Font.Color = System.Drawing.Color.Blue; builder.Write("aaa"); doc.Save("c:\\1.doc"); } } } So it looks like COM Interop problem.

    Read the article

  • Unexpected Event Behavior When Using VB6 with COM Interop (C#)

    - by Randal
    We are using a COM Interop (C#) to allow for a VB6 application to send data to a server. Once the server receives the data, the managed code will raise a DataSent event. This event is only fired after a correlation ID is returned to the original caller. About 1% of the time, we've encountered VB6 executing the raised event before finishing the function that originally sent the data. Using the following code: ' InteropTester.COMEvents is the C# object ' Dim WithEvents m_ManagedData as InteropTester.COMEvents Private Sub send_data() Set m_ManagedData = new COMEvents Dim id as Integer ' send 5 to using the managed interop object ' id = m_ManagedData.SendData(5) LogData "ID " & id & " was returned" m_correlationIds.Add id End Sub Private Sub m_ManagedData_DataSent(ByVal sender as Variant, ByVal id as Integer) LogData "Data was successfully sent to C#" ' check if the returned ID is in the m_correlationIds collection goes here' End Sub We can verify that the id is returned with a value when we call m_ManagedData.SendData(5), but the logs then show that the m_ManagedData_DataSent is occasionally called before send_data ends. How is possible for VB6 to access the Message Loop to know that the DataSent event was raised before exiting send_data()? We are not calling DoEvents and everything within VB6 is synchronous. Thanks in advance for your help.

    Read the article

  • Releasing Excel after using Interop

    - by figus
    Hi everyone I've read many post looking for my answer, but all are similar to this: http://stackoverflow.com/questions/1610743/reading-excel-files-in-vb-net-leaves-excel-process-hanging My problem is that I don't quit the app... The idea is this: If a User has Excel Open, if he has the file I'm interested in open... get that Excel instance and do whatever I want to do... But I don't to close his File after I'm done... I want him to keep working on it, the problem is that when he closes Excel... The process keeps running... and running... and running after the user closes Excel with the X button... this is how I try to do it This piece is used to know if he has Excel open, and in the For I check for the file name I'm interested in. Try oApp = GetObject(, "Excel.Application") libroAbierto = True For Each libro As Microsoft.Office.Interop.Excel.Workbook In oApp.Workbooks If libro.Name = EquipoASeccionIdSeccion.Text & ".xlsm" Then Exit Try End If Next libroAbierto = False Catch ex As Exception oApp = New Microsoft.Office.Interop.Excel.Application End Try here would be my code... if he hasn't Excel open, I create a new instance, open the file and everything else. My code ends with this: If Not libroAbierto Then libroSeccion.Close(SaveChanges:=True) oApp.Quit() Else oApp.UserControl = True libroSeccion.Save() End If System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroOriginal) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroSeccion) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(origen) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(copiada) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oApp) libroOriginal = Nothing libroSeccion = Nothing oApp = Nothing origen = Nothing copiada = Nothing nuevosGuardados = True So you can see that, if I opened the file, I call oApp.Quit() and everything else and the Excel Process ends after a few seconds (maybe 5 aprox.) BUT if I mean the user to keep the file open (not calling Quit()), Excel process keeps running after the user closes Excel with the X button. Is there any way to do what I try to do?? Control a open instance of excel and releasing everything so when the user closes it with the X button, the Excel Process dies normally??? Thanks!!!

    Read the article

  • How do I set up MVP for a Winforms solution?

    - by JonWillis
    Question moved from Stackoverflow - http://stackoverflow.com/questions/4971048/how-do-i-set-up-mvp-for-a-winforms-solution I have used MVP and MVC in the past, and I prefer MVP as it controls the flow of execution so much better in my opinion. I have created my infrastructure (datastore/repository classes) and use them without issue when hard coding sample data, so now I am moving onto the GUI and preparing my MVP. Section A I have seen MVP using the view as the entry point, that is in the views constructor method it creates the presenter, which in turn creates the model, wiring up events as needed. I have also seen the presenter as the entry point, where a view, model and presenter are created, this presenter is then given a view and model object in its constructor to wire up the events. As in 2, but the model is not passed to the presenter. Instead the model is a static class where methods are called and responses returned directly. Section B In terms of keeping the view and model in sync I have seen. Whenever a value in the view in changed, i.e. TextChanged event in .Net/C#. This fires a DataChangedEvent which is passed through into the model, to keep it in sync at all times. And where the model changes, i.e. a background event it listens to, then the view is updated via the same idea of raising a DataChangedEvent. When a user wants to commit changes a SaveEvent it fires, passing through into the model to make the save. In this case the model mimics the view's data and processes actions. Similar to #b1, however the view does not sync with the model all the time. Instead when the user wants to commit changes, SaveEvent is fired and the presenter grabs the latest details and passes them into the model. in this case the model does not know about the views data until it is required to act upon it, in which case it is passed all the needed details. Section C Displaying of business objects in the view, i.e. a object (MyClass) not primitive data (int, double) The view has property fields for all its data that it will display as domain/business objects. Such as view.Animals exposes a IEnumerable<IAnimal> property, even though the view processes these into Nodes in a TreeView. Then for the selected animal it would expose SelectedAnimal as IAnimal property. The view has no knowledge of domain objects, it exposes property for primitive/framework (.Net/Java) included objects types only. In this instance the presenter will pass an adapter object the domain object, the adapter will then translate a given business object into the controls visible on the view. In this instance the adapter must have access to the actual controls on the view, not just any view so becomes more tightly coupled. Section D Multiple views used to create a single control. i.e. You have a complex view with a simple model like saving objects of different types. You could have a menu system at the side with each click on an item the appropriate controls are shown. You create one huge view, that contains all of the individual controls which are exposed via the views interface. You have several views. You have one view for the menu and a blank panel. This view creates the other views required but does not display them (visible = false), this view also implements the interface for each view it contains (i.e. child views) so it can expose to one presenter. The blank panel is filled with other views (Controls.Add(myview)) and ((myview.visible = true). The events raised in these "child"-views are handled by the parent view which in turn pass the event to the presenter, and visa versa for supplying events back down to child elements. Each view, be it the main parent or smaller child views are each wired into there own presenter and model. You can literately just drop a view control into an existing form and it will have the functionality ready, just needs wiring into a presenter behind the scenes. Section E Should everything have an interface, now based on how the MVP is done in the above examples will affect this answer as they might not be cross-compatible. Everything has an interface, the View, Presenter and Model. Each of these then obviously has a concrete implementation. Even if you only have one concrete view, model and presenter. The View and Model have an interface. This allows the views and models to differ. The presenter creates/is given view and model objects and it just serves to pass messages between them. Only the View has an interface. The Model has static methods and is not created, thus no need for an interface. If you want a different model, the presenter calls a different set of static class methods. Being static the Model has no link to the presenter. Personal thoughts From all the different variations I have presented (most I have probably used in some form) of which I am sure there are more. I prefer A3 as keeping business logic reusable outside just MVP, B2 for less data duplication and less events being fired. C1 for not adding in another class, sure it puts a small amount of non unit testable logic into a view (how a domain object is visualised) but this could be code reviewed, or simply viewed in the application. If the logic was complex I would agree to an adapter class but not in all cases. For section D, i feel D1 creates a view that is too big atleast for a menu example. I have used D2 and D3 before. Problem with D2 is you end up having to write lots of code to route events to and from the presenter to the correct child view, and its not drag/drop compatible, each new control needs more wiring in to support the single presenter. D3 is my prefered choice but adds in yet more classes as presenters and models to deal with the view, even if the view happens to be very simple or has no need to be reused. i think a mixture of D2 and D3 is best based on circumstances. As to section E, I think everything having an interface could be overkill I already do it for domain/business objects and often see no advantage in the "design" by doing so, but it does help in mocking objects in tests. Personally I would see E2 as a classic solution, although have seen E3 used in 2 projects I have worked on previously. Question Am I implementing MVP correctly? Is there a right way of going about it? I've read Martin Fowler's work that has variations, and I remember when I first started doing MVC, I understood the concept, but could not originally work out where is the entry point, everything has its own function but what controls and creates the original set of MVC objects.

    Read the article

  • GetWindowPlacement/SetWindowPlacement not working in WinForms for high DPI

    - by RandomEngy
    I've got a legacy WinForms app and I want to save the window position and size across sessions. I've been using GetWindowPlacement and SetWindowPlacement during the FormClosing and Load events. The problem I'm getting is that at higher DPI settings (Such as Medium, size at 125%) the sizes keep inflating. I'll call SetWindowPlacement on it with a certain size, but when GetWindowPlacement is called, those numbers come back 25% bigger, even though the window was the same size all along. The same sort of problem exists when saving the size of a resizable element within the form. Now this works fine if I create a new WinForms project: The size stays stable even when running at the higher DPI. I'm guessing there's some legacy setting in the bowels of the project or some arcane Form setting that's messing it up, but I can't find out where. I've called IsProcessDPIAware on both projects and both are true. Does anyone know what might be causing this?

    Read the article

  • IHierarchyData and IHierarchicalEnumerable in Winforms

    - by Jonathan
    Hi! Currently,I know how to do a lazy implementation of the loading procedure of the nodes in a treeview control, and read the related questions in stackoverflow, but I'm also reading about IHierarchyData and IHierarchicalEnumerable interfaces in asp.net (I didn't know to code asp.net) that allow to bind a collection to a treeview in order to display the items automatically. It would like to know if I can do the same in winforms and C#. I think that the interfaces previous mentioned are not available in winforms. Thanks.

    Read the article

  • How to get default Ctrl+Tab functionality in WinForms MDI app when hosting WPF UserControls

    - by jpierson
    I have a WinForms based app with traditional MDI implementation within it except that I'm hosting WPF based UserControls via the ElementHost control as the main content for each of my MDI children. This is the solution recommended by Microsoft for achieving MDI with WPF although there are various side effects unfortunately. One of which is that my Ctrl+Tab functionality for tab switching between each MDI child is gone because the tab key seems to be swallowed up by the WPF controls. Is there a simple solution to this that will let the Ctrl+tab key sequences reach my WinForms MDI parent so that I can get the built-in tab switching functionality?

    Read the article

  • WinForms HTML visualizing controls comparison

    - by DarkDeny
    Hello all! I am working on some project which requires some HTML visualizing control (WinForms). Currently I am aware only of two such a controls: AxWebBrowser (as far as I understand this is IE-based ActiveX control for winforms) Nabu HTMLView (open source library with visualizing capabilities). Are there any other choices? What are their cons and pros? How configurable they are? For example I want to disable navigation and scripts, hook onto loading methods to override resources loading and so on.

    Read the article

  • c# winforms - scrollable panel with rectangles

    - by Peanut
    Hi, I'm new to winforms and have tried to track down an answer to the following with no luck ... I have a panel in winforms and add to it a Rectangle that is wider than the panel itself. I've set the panel AutoScroll property to true however the panels horizontal scrollbar never appears. Why is this? And how do I get the scrollbar to scroll? Here is my code to add the rectangle: private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rec = new Rectangle(2, 2, 400, 40); g.DrawRectangle(new Pen(Color.Black), rec); g.FillRectangle(new SolidBrush(Color.Blue), rec); } If I add a Label control to the panel and give it a text value that will go beyond the bounds of the panel - then the autoscroll works, but just not for a rectangle. Many thanks.

    Read the article

  • Winforms Which Design Pattern / Agile Methodology to choose

    - by ZedBee
    I have developed desktop (winforms) applications without following any proper design pattern or agile methodologies. Now I have been given the task to re-write an existing ERP application in C# (Winforms). I have been reading about Domain Driven Design, scrum, extreme programming, layered architecture etc. Its quite confusing and really hard (because of time limitations) to go and try each and every method and then deciding which way to go. Its very hard for me to understand the bigger picture and see which pattern and agile methodology to follow. To be more specific about what I want to know is that: Is it possible to follow Domain Driven Design and still be agile. Should I choose Extreme programming or scrum in this specific scenario Where does MVP and MVVM fits, which one would be a better option for me

    Read the article

  • Current ways to do data binding in .NET 3.5 with C# 3.0 and WinForms

    - by kryptic
    Hello Everyone, I have an existing C# 3.0 WinForms project with .NET 3.5 that talks to a MySQL database. I would like to use data binding (I'm new to this, so I've been doing all of the UI updates manually) to simplify things. I followed a link from this question to this article which mentions using a DataSet but also follows up with "my view on this topic is strongly in favor of Business Objects." Also that was with .NET 2.0. What are the current methods to use data binding with a WinForms application? What are their advantages in terms of simplicity, how much additional code is necessary, etc. For reference, I use an ORM approach to build objects with public properties from a database. I want to map these properties for each object onto UI elements like TextBoxes. There could be many properties for an object so I want to simplify the code to do this.

    Read the article

  • Sharing a custom datasource between Winforms and Webforms

    - by Earlz
    Hello, I'd like to create a custom datasource that is shared between a Winforms and Webforms project. This functions as a middle layer for a reporting tool(DevExpress Reporting). The Webforms project is a designer for these reports. So we want for the reports to be capable of going to the server to get data and such. So our datasource would abstract away all the communication overhead. Then, for consistency, the datasource would also run on the server for reporting, except for their would be no communication. What would be the best course of action? There doesn't seem to be such a thing as a DataSource in Winforms. Is DataSource not the thing I'm looking for? Edit: After some research, it appears that IDataAdapter may be good for my purpose. Any opinion on that?

    Read the article

  • Using Microsoft.Office.Interop to save created file with C#

    - by Eyla
    I have the this code that will create excel file and work sheet then insert same values. The problem I'm facing that I'm not able to save the file with name giving ten colse it. I used SaveAs but did not work: wb.SaveAs(@"C:\mymytest.xlsx", missing, missing, missing, missing, missing, XlSaveAsAccessMode.xlExclusive, missing, missing, missing, missing, missing); this line of code would give me this error: Microsoft Office Excel cannot access the file 'C:\A3195000'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook. please advice to solve this problem. here is my code: private void button1_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { MessageBox.Show("EXCEL could not be started. Check that your office installation and project references are correct."); return; } xlApp.Visible = true; Workbook wb = xlApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet ws = (Worksheet)wb.Worksheets[1]; if (ws == null) { MessageBox.Show("Worksheet could not be created. Check that your office installation and project references are correct."); } // Select the Excel cells, in the range c1 to c7 in the worksheet. Range aRange = ws.get_Range("C1", "C7"); if (aRange == null) { MessageBox.Show("Could not get a range. Check to be sure you have the correct versions of the office DLLs."); } // Fill the cells in the C1 to C7 range of the worksheet with the number 6. Object[] args = new Object[1]; args[0] = 6; aRange.GetType().InvokeMember("Value", BindingFlags.SetProperty, null, aRange, args); // Change the cells in the C1 to C7 range of the worksheet to the number 8. aRange.Value2 = 8; // object missing = Type.Missing; // wb.SaveAs(@"C:\mymytest.xlsx", missing, missing, missing, missing, //missing, XlSaveAsAccessMode.xlExclusive, missing, missing, missing, missing, //missing); }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >