Search Results

Search found 2806 results on 113 pages for 'winforms'.

Page 40/113 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • asp.net windows forms - best place to persist application data

    - by mikeh
    For Windows.Forms, I have an application that needs to get a unique install id for each install from my server, and then persist this data so once registered, the install ID is included on all communications back to the server. The application is in occasional contact with the server. How can I persist this data on the client in a way that is not easily tampered with?

    Read the article

  • Designer serialization persistence problem in .NET, Windows Forms

    - by Jules
    ETA: I have a similar, smaller, problem here which, I suspect, is related to this problem. I have a class which has a readonly property that holds a collection of components (* not quite, see below). At design time, it's possible to select from the components on the design surface to add to the collection. (Think imagelist, but instead of selecting one, you can select as many as you want.) As a test, I inherit from button and attach my class to it as a property. The persistence problem occurs when I add a component,to the collection, from the design surface after I have added my button to the form. The best way to demonstrate this is to show you the designer generated code: Private Sub InitializeComponent() Dim Provider1 As WindowsApplication1.Provider = New WindowsApplication1.Provider Me.MyComponent2 = New WindowsApplication1.MyComponent Me.MyComponent1 = New WindowsApplication1.MyComponent Me.MyButton1 = New WindowsApplication1.MyButton Me.MyComponent3 = New WindowsApplication1.MyComponent Me.SuspendLayout() ' 'MyButton1 ' Me.MyButton1.ProviderCollection.Add(Me.MyButton1.InternalProvider) Me.MyButton1.ProviderCollection.Add(Me.MyComponent1.Provider) Me.MyButton1.ProviderCollection.Add(Me.MyComponent2.Provider) Me.MyButton1.ProviderCollection.Add(Provider1) //Wrong should be Me.MyComponent3.Provider ' 'Form1 ' Me.Controls.Add(Me.MyButton1) End Sub Friend WithEvents MyComponent1 As WindowsApplication1.MyComponent Friend WithEvents MyComponent2 As WindowsApplication1.MyComponent Friend WithEvents MyButton1 As WindowsApplication1.MyButton Friend WithEvents MyComponent3 As WindowsApplication1.MyComponent End Class As you can see from the code, the collection is not actually a collection of the components, but a collection of a property, 'Provider', from the components. It looks like the problem is occurring because MyComponent3 is created after MyButton. However, in my opinion, this should not make any difference - by the time the serializer comes to add the provider property of MyComponent3, it's already created. Note: You may wonder, why I'm not using AddRange to persist the collection. The reason for this is that if I do, the behaviour changes and none of the items will persist correctly. The designer will create local fields - like Provider1 - for each item in the collection. However if I add another collection to the class which holds the actual MyComponents and persist this, then, somehow, the AddRange method persists correctly in ProviderCollection! There seems to be some kind of quantum double slit experiment going down in code dom. How can I solve this problem?

    Read the article

  • When should I be cautious using about data binding in .NET?

    - by Ben McCormack
    I just started working on a small team of .NET programmers about a month ago and recently got in a discussion with our team lead regarding why we don't use databinding at all in our code. Every time we work with a data grid, we iterate through a data table and populate the grid row by row; the code usually looks something like this: Dim dt as DataTable = FuncLib.GetData("spGetTheData ...") Dim i As Integer For i = 0 To dt.Rows.Length - 1 '(not sure why we do not use a for each here)' gridRow = grid.Rows.Add() gridRow(constantProductID).Value = dt("ProductID").Value gridRow(constantProductDesc).Value = dt("ProductDescription").Value Next '(I am probably missing something in the code, but that is basically it)' Our team lead was saying that he got burned using data binding when working with Sheridan Grid controls, VB6, and ADO recordsets back in the nineties. He's not sure what the exact problem was, but he remembers that binding didn't work as expected and caused him some major problems. Since then, they haven't trusted data binding and load the data for all their controls by hand. The reason the conversation even came up was because I found data binding to be very simple and really liked separating the data presentation (in this case, the data grid) from the in-memory data source (in this case, the data table). "Loading" the data row by row into the grid seemed to break this distinction. I also observed that with the advent of XAML in WPF and Silverlight, data-binding seems like a must-have in order to be able to cleanly wire up a designer's XAML code with your data. When should I be cautious of using data-binding in .NET?

    Read the article

  • How can I provide a different rendering target to Direct2D?

    - by fingerprint211b
    I'm using Direct2D in C# to render a small gui framework for my research project. I'm not very used to working on Windows or with DirectX. I'm using a Windows Forms control to create a render target, and msdn warns that since it uses BindDC, a the larger the rendering target, the worse the performance will be (which turned out to be a dramatic difference, when I maximize the window, I get around 15 fps). What would be a better way to create a render target for Direct2D? Is there a way to create a window and render directly to it, instead of rendering to a control's buffer first, and then rendering that? If so, how? Sorry if my English sucks, not my native language.

    Read the article

  • Windows Forms: Enable/Disable WS_CLIPCHILDREN

    - by Agnel Kurian
    How do I turn on/off the WS_CLIPCHILDREN window style in a Windows Forms parent control? I would like to display some text on top of the child control after it has painted. In my parent control, this is what I have: class Parent : public Control { void Parent::OnPaint(PaintEventArgs ^e){ Control::OnPaint(e); // parent draws here // some drawing should happen over the child windows // in other words, do not clip child window regions } }; On checking with Spy++ I find that the parent has the WS_CLIPCHILDREN window style enabled by default. What is the Windows Forms way to turn this off? Note: Sample code is in C++/CLI but I have tagged this C# for visibility... language is immaterial here. Feel free to translate the code to C#.

    Read the article

  • Setting AcceptButton to None still closes the form on ENTER.

    - by Vilx-
    I have a MDI windows forms application and my child forms mostly have "OK" and "Cancel" buttons. However I do not want them to be activated with ENTER/ESC keys to prevent accidental saves/aborts. So, the form has both AcceptButton and CancelButton set to none. The ESC button indeed does nothing, but the ENTER button still closes the form by "clicking" on the first button found, sorted by TabOrder. Why is this so? Must I really start doing workarounds and catching the ENTER key?

    Read the article

  • Is there a way to delay an event handler (say for 1 sec) in Windows Forms

    - by Essam
    I need to be able to delay the event handlers for some controls (like a button) to be fired for example after 1 sec of the actual event (click event for example) .. is this possible by the .net framework ? I use a timer and call my code from the timer's tick event as below but I am not sure if this is the best approach ! void onButtonClick( ..) { timer1.Enabled = true; } void onTimerTick( ..) { timer.Enabled = false; CallMyCodeNow(); }

    Read the article

  • WPF User Control is causing Out of Memory Exception

    - by Chairman Meow
    Looking for a free spell checking solution, I thought I was so smart in doing this but I guess not. I have created a windows form based application and I want the form to add a user specified amount of user controls (with textboxes) on to a panel. The user can then click some button and the controls on this panel are cleared and new ones are added. The user does something and the process is repeated. Now, I wanted these textboxes to support spell checking and looked all over for a free solution. WPF textboxes support spell checking where the ones in regular win forms do not. I thought I would be able to use these WPF textboxes by adding them to an ElementHost object which is, in turn, within a panel. This panel would be a user control. So, in my application, I would be able to add instances of these user controls onto the form and make use of .NET's spell checking goodness. This actually worked but after using the application for a while, found that the application would eventually freeze on me due to out of memory errors. I have pinpointed the memory errors to these WPF controls since this problem does not happen with normal textboxes. When the window is opened and the number of controls is specified, this is pretty much how the controls are added: Dim xOffset As Integer = 0 For i As Integer = 0 To theNumber Dim myUserControl As New SpecialUserControl() myPanel.Controls.Add(myUserControl) myUserControl.Location = New Point(7, 7) myUserControl.Location = New Point(xOffset, 7) xOffset = xOffset + 207 Next Note that: myPanel is a panel on a form SpecialUserControl is the user control with WPF textbox (within an ElementHost object) When the user pressed a button, the panel is cleared: myUserControl.Controls.Clear() The user can then repeat the process. There are a lot of results on the internet when I tried to find a solution and I'm thinking that the problem I am having is due to the fact that the WPF control is not going away even after clearing the panel. Following this conclusion, I have tried different solutions regarding disposing these controls or setting them to nothing but the memory problem keeps occurring. If someone could give me some advice or ideas here, I'd really appreciate it.

    Read the article

  • WebClient.UploadFile() throws exception while uploading files to sharepoint

    - by Royson
    In my application i am uploading files to sharepoint 2007. I am using using (WebClient webClient = new WebClient()) { webClient.Credentials = new NetworkCredential(userName, password); webClient.Headers.Add("Content-Type", "application/x-vermeer-urlencoded"); webClient.Headers.Add("X-Vermeer-Content-Type", "application/x-vermeer-urlencoded"); String result = Encoding.UTF8.GetString(webClient.UploadData(webUrl + "/_vti_bin/_vti_aut/author.dll","POST", data.ToArray())); } the code is running successfully..but for some files it throws exception The underlying connection was closed: The connection was closed unexpectedly. at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) at System.Net.WebClient.UploadData(Uri address, String method, Byte[] data) at System.Net.WebClient.UploadData(String address, String method, Byte[] data) Any Ideas what I have done wrong? I am using VS-2008 2.0

    Read the article

  • Insert a Row with a sorted DataGridView

    - by Ruben Trancoso
    My DataGridView is bound to the same BindingSource as the Insert Form, and the Name column is sorted. After insert is done, the groupBindingSource.Current is not returning the new inserted DataRowView but the last row in the sort order what makes the Update do nothing. FormGroup formGroup = new FormGroup(); formGroup .Source = groupBindingSource; formGroup .setMode(FormGroup.Mode.Insert); if (formGroup .ShowDialog() == DialogResult.OK) { DataRowView drv = (DataRowView)groupBindingSource.Current; grupoTableAdapter.Update(drv.Row); }

    Read the article

  • How to write content in a text file at the end of each line

    - by saravanan
    Hi, I am having one text file which contain following kind of data. "3P","Smith","Richard","3 Point Promotions","3P","[email protected]","IDA","Yes",,,,0,4,5,83.33,10, "A1","Ernest","Amy","TAKE 1 Promotional Products","LCOOK","[email protected]","IDA","Yes",,,,0,6,7,,0, "A2","Derek","Eaton","Advertising Edge Promotions","AE","[email protected]","IDA","Yes",,,,0,8,8,,10, "AAA","Abercrombie","Jerry","AAA Specialty Wholesale Inc","AAA","[email protected]","IDA","Yes",,,,0,9,9,,10, "AAP","Halberstam","Mendy","All About Promotions","AAP","[email protected]","IDA","Yes",,,,0,10,10,,12, Each of them are separate line.Now i want add another column in each like this "3P","Smith","Richard","3 Point Promotions","3P","[email protected]","IDA","Yes",,,,0,4,5,83.33,10,**96** "A1","Ernest","Amy","TAKE 1 Promotional Products","LCOOK","[email protected]","IDA","Yes",,,,0,6,7,,0,**97** "A2","Derek","Eaton","Advertising Edge Promotions","AE","[email protected]","IDA","Yes",,,,0,8,8,,10,**98** "AAA","Abercrombie","Jerry","AAA Specialty Wholesale Inc","AAA","[email protected]","IDA","Yes",,,,0,9,9,,10,**99** "AAP","Halberstam","Mendy","All About Promotions","AAP","[email protected]","IDA","Yes",,,,0,10,10,,12,**100** How i read content in line by line.And also how to write another value in same text file at each line.Please send solution for this problem.I am waiting for your reply.Thanks for reply. -Saravanan

    Read the article

  • How do I load SciLexer.dll in Visual Studio 2008 Designer, on Windows 7 64-bit?

    - by Filini
    We develop a WinForm application using Scintilla.NET (1.7) component, which uses SciLexer.dll (unamnaged). At run-time, we distribute both 32bit and 64bit SciLexer.dll, and we load the correct one when the application starts (everything works fine). On our new development environments (Windows 7 64-bit), all our solutions build and run just fine, but the WinForm visual designer does not load our forms/controls which use Scintilla.NET, because it cannot load the correct SciLexer.dll: Window class name is not valid. at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass() at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, Int32 classStyle) at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Control.get_Handle() at Scintilla.ScintillaControl.SendMessageDirect(UInt32 msg, IntPtr wParam, IntPtr lParam) at Scintilla.ScintillaControl.SendMessageDirect(UInt32 msg) at Scintilla.ScintillaControl.get_CodePage() at Scintilla.ScintillaControl..ctor(String sciLexerDllName) at Scintilla.ScintillaControl..ctor() Where does Visual Studio 2008 look for unmanaged libraries? I tried putting the 64-bit SciLexer.dll in SysWOW64, in the folder where ScintillaNET.dll is referenced, adding a folder in PATH system variable, adding a folder reference in the project, but I keep getting this error. Any help is appreciated.

    Read the article

  • Sending keystrokes to a program

    - by Or Betzalel
    In window form, I made a button and I'm trying to make it send F1 to a specific window (Such as FireFox, My Computer, etc...) My questions are : How do I do it by the window's name? (such as "Mozilla Firefox") How do I do it by the process's name? (such as firefox.exe)

    Read the article

  • .net Value Class sorting with IComparable

    - by greggorob64
    I'm running into an issue using a DataGridView bound to a iBindingListView implementation (third party dll) attached to a large collection. There's a certain property in my collection type, named MyDateTime, which is a value class similar to DateTime, but also with some legacy code. This VALUE CLASS implements iComparable, iComparable<T>, and iEquatable<T>. The issue I'm having is this: When I apply a sort to the iBindingListView, or the Automatic Sorting provided by the DGV on the MyDateTimeColumn, it ALWAYS uses the non-generic iComparer, causing hundreds of thousands of unnecessary boxing and unboxing. When I remove the non-generic iComparer, the generic one is still not used, it just does a string compare on the .ToString(). Am I missing something? Why is my generic comparer not bieng called on a sort?

    Read the article

  • Neither Invalidate() nor Refresh() invokes OnPaint()

    - by user181813
    I'm trying to get from Line #1 to Line #2 in the below code: using System; using System.Windows.Forms; namespace MyNameSpace { internal class MyTextBox : System.Windows.Forms.TextBox { protected override void OnEnabledChanged(EventArgs e) { base.OnEnabledChanged(e); Invalidate(); // Line #1 - can get here Refresh(); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); System.Diagnostics.Debugger.Break(); // Line #2 - can't get here } } } However, it seems that neiter Invalidate() nor Refresh() causes OnPaint(PaintEventArgs e) to be invoked. Two questions: Why doesn't it work? If it can't be fixed: I only want to invoke OnPaint(PaintEventArgs e) in order to access the e.Graphics object - is there any other way to do this?

    Read the article

  • how to get all controls of win form?

    - by Shailesh
    i have a win form named A , A contains lots of different controls ,first contains a main groubbox and this groupbox countains lots of table and others group boxes. i want to find a control which has tab index 9(example) in form A but i dont know which groubox contains this control. how i found this control. regards Shailesh

    Read the article

  • How to make a UserControl with a custom DefaultBackColor?

    - by Blorgbeard
    When I right-click on my custom UserControl's BackColor property in the property-grid, then click Reset, I would like the BackColor property to change to (for example) Color.LightGreen, and the property value to appear un-bolded, to indicate that it is the default value. Currently, I know I can do this: public override void ResetBackColor() { BackColor = Color.LightGreen; } Which works as far as setting it to LightGreen on reset. But it still appears bolded in the property-grid, indicating that the current value is not the default. I notice that the Control class has a static read-only property, DefaultBackColor. Unfortunately, since it's static, I cannot override it. Is there some way to get all the functionality I want?

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >