Answer Questions
dbeau SaveFileDialog how to use?
I have a richtextbox1 on a child form inwhich I write a small bit of text in. I then want to save the text from this richtextbox into a .txt file. I have got the saveDialog menu at the bottom of my screen But I am unsure how to correctly make this all work. I know there should be some dialog.filter and index for txt files code somewhere but I dont know where. The code i have done so far is :- private void saveToolStripMenuItem_Click( object sender, EventArgs e) { DialogResult dr = saveFileDialog1.ShowDialog(); if (dr != DialogResult .OK) return ; else { StreamWriter sw = new StreamWriter ( "filename" ); sw.Write( ); //What should I put in the Write function } } Also is ope ...Show All
AtomZ .be need help with properties while creating usercontrol
Hi, I'm creating a usercontrol with some public properties to display in the propertywindow. I want to display the properties under category. like how we have form.size category has some properties. Please help me with this. venp I think you want that PLUS sign and when you click it the 3 properties will show. I thought you just want them in their own category block, ex. Misc, Layout, and etc. If you want the plus sign, you will need to create a single property that has the 3 properties as its own sub-properties. You can achieve this by using a class to group the 3 properties. class MyCategory { // define the 3 properties } class MyUserControl { public MyCategory Changeable = new MyCategory(); // ...Show All
kforrey Property Cancel of RowValidating of DataGridView
Hi everyone, I would like to known if anyone already had this problem or if it is a bug of C#. I'm having problems with the property Cancel of RowValidating of DataGridView. If anyone can test and send me the fix I'll been thankful. The situation is listed below (is very simple): 1) Environment .Net Framework 2.0; 2) Windows Form with a TextBox and a DataGridView; 3) CausesValidation is true in both objects (TextBox and DataGridView); 4) DataGridView EditMode = EditOnKeystrokeOrF2 (default); 5) All properties are in default state; 6) On event RowValidating from DataGridView, I set up the Cancel property to true. I do this to the selected line don't lost the focus if some error occurs on validation of cells; The problem: 1) If t ...Show All
Ryan S. Need Help getting image to show up in PictureBox
I have a program that has an openFileDialog and some pictureboxes that I want pictures to show up in according to the images you choose in the openfiledialog from the local harddrive. But I don't know what to type in the GetThumbnailImage(); private void openToolStripMenuItem_Click( object sender, EventArgs e) { if (AddPic.ShowDialog() == System.Windows.Forms. DialogResult .OK) pictureBox1.Image.GetThumbnailImage(); } Thank u Kumar_jac. where did it give you a nullreference exception did you even load an image the code I supplied was an example...you would have to put in all the error trapping and so on :-) I do understand and the attempted solution given, should work. Overall this is what you need ...Show All
Alexey Raga Is there a Scale Bug?
I'm developing in VS2005 (C++/CLI) on a machine with a resolution of 1600x1200. I have a form (Form1 built with the designer) that contains several controls including GroupBoxes, TextBoxes, ListBoxes, DataGridViews and Labels. When the form is run on machines with 1024x768 or lower it will not scale. Only the upper left part of the form shows and the user cannot see the rest of the form nor can he expand the form to see the entire form. Scroll bars do not appear regardless of the AutoScroll property setting. I have tried setting the form's AutoScaleMode property to Font and to Dpi with no success. I've also tried using AutoScroll to no avail. I did some looking in Debug and made an interesting discovery. With the AutoScaleMode proper ...Show All
Luke Yang How to Access Components from different Form
I am a newbie to C#, I created a simple WinApp. in mainForm.cs has a spliterPanel1 and textBox1 in pannelSpliter.panel2. Then I added a userControl.cs, it has a button1 component with mouse Click even. However I got a compiler errors " The name 'textBox1' does not exist in the current context ". Could anyone give me some hints how to access component from different from Thanks in mouse Click even, private void button1_Click( object sender, EventArgs e) { textBox.Text = "text" ; } UserControl: namespace WindowsApplication1 { public delegate void UserClick(object sender, EventArgs e); public partial class UserControl1 : UserControl { ...Show All
Coss How to Click a Button in another Application Programmatically in C#?
I would like to invoke the button click event from one application to another application. Is there any to way to trigger the other application events from the main application. Please help. Thanks in advance. Hi, Pradeep The WndProc method recieves the message regardless whether the form is visible or not. But button1.PerformClick() method are not fired when the form is hiden. Try to use other method instead of such method can solve the problem. (if you want to raise the button click event, just call the handle delegate: button1_Click(null, null); ) Thanks Hi Figo Fei, Thanks for the brief explanation about Remoting Overview. If possible, could you please provide me a bit of code snippet for trigg ...Show All
flandercan :: I have never succeeded in hiding a property ::
Here is my situation: I have a control inherited from MaskedTextBox . I added a property called Value . I want the users of this new control to use the Value property and not use the Text property when setting a new value to this control. Therefore my intention is to hide the Text property from external use. I tried making the property Private but that doesn't work. Anyone have an idea Thank you. Thank you to the both of you for you ideas and suggestions, i will try them out. And yes the idea behind this was to in fact hide it from the code and designer. I will let you know if I succeed. Thanks again. Great to see developers help each other. :) ...Show All
twaltz Deploy multiple exe's
Hi I have a windows application and I have a windows service. I want to make one installer and install both the windows application and the windows service. This is the first time I was doing something like this. How do I proceed with this Any article links or help will be appreciated. ...Show All
mpetanovitch DataGridView, BindingNavigator, and New Row
Hi, I have a DataGridView and a BindingNavigator bound to the same BindingSource (which is in its turn bound to a DataTable from a typed DataSet). DataGridView.AllowUserToAddRow = True, so the New Row is visible. I've noticed that clicking the BindingNavigator.AddNewItem button does not select the New Row. In stead, it creates a new record at the end of the DGV, just before the New Row. Is this default behaviour, or does it behave like this because of something in my code (Sorry if this is explained somewhere else and I missed it. Seems like a straightforward scenario to me, but I couldn't find any explanation.) Because of this behaviour, calculating and setting default values for the new row isn't as straightforward as it see ...Show All
cdaviduik Loading Controls based on contents of a database
Hey everyone, I have question about loading controls based on the contents of a database. So I'm building a windows application that uses a fairly large database, about 100,000 records. I have about three tables in my database. I have to create three forms for each table, o, by the way, the tables are related to each other. I have to create three forms for each table, the first form is the main form and what ever the user chooses on the first form, displays the query results on the second form, and what ever the user chooses on the second form, displays the query results on the thrid form. In short, whatever the user selects on the previous form, a id is pass to a query and results of this query should display on the next form. S ...Show All
GrandpaB Databindings - urgent Help needed
Dear Friends I have an employee master form wiht having 5 tables. My requuirement is when the user opens the form, it must be the add new record mode. My problem is i can add new employee first time. After saving am reseting the dataset using clear(). After that when i add the next employee, it throws error saying the index out of range. This is when i refer the row[0] of the emp data adapter. //*********** MY Reset script dsEmp.Clear(); this.BindingContext[dsEmp, "HR_M_EMPLOYEE"].EndCurrentEdit(); this.BindingContext[dsEmp, "HR_M_EMPLOYEE"].AddNew(); this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_EAR"].EndCurrentEdit(); this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_EAR"].AddNew(); this.BindingContex ...Show All
rsri Add Serial Number column DataGrid 1.1
Hi! I am using the DataGrid control in framework 1.1. What i need to do is add an additional column in the DataGrid which display the serial number for each row. This column(field) has no relation or value in the table i will bind the gird to, but will only be used for display puposes. I have looked at How to dynamically number rows in a SELECT Transact-SQL statement . and also creating stored procedures that will create a new identity field and put that data into a temp table from which i can bind the grid. They dont however solve my problem. Is there a simpler way of doing this Any help would be appreciated. thanks, Rohan Maybe this will help Dim dt As New DataTable Private Sub Form1_Load( ...Show All
Stuart McHugh Problem with Automatic Text Wrapping and MeasureString
I've been trying to create my own Chart control, and I've been having a problem printing the labels against the x-axis. I divide the x-axis into the number of elements being displayed on the chart. I then measure the width of the text of the labels, to make sure they fit, using MeasureString and passing it a RectangleF to work out if all the characters fit in. My problem is that when I call MeasureString, the charactersFitted parameter comes back with weird information. Say I meaure the string "30th Birthday Celebrations", and "30th" and "Birthday Celebrations" are printed on 2 lines (the second only saying "Birthday Cel". The MeasureString returns 14 characters fitted and 2 lines I can't ...Show All
perstam Custom Control Error
I have created a custom control, and added it to my toolbox. I have then used it on a form in the same project, and it refuses to compile. I have made no modifications to the cutom control, using only trhe default code from the add item wizard. The error i recieve is The type name <my custom type name here> does not exist in <form name.form name> When I say form name it may be the namespace as they are the same.If i click it to take me to the problem, I get directed to the aut genearted InitializeComponent method. Whats going on Any help much appreciated, Mike Controls added in the Designer result in code being added to InitializeComponent. Properties that non-default are explicitly set insi ...Show All
