Search Results

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

Page 69/113 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • How do I make a GUI that behaves like this?

    - by Karl Knechtel
    This is difficult to explain without illustration, so - behold, an illustration, cobbled together from screenshots of a few hello-world examples and a lot of Paint work: I have started out using Windows Forms on .NET (via IronPython, but that shouldn't be important), and haven't been able to figure out very much. GUI libraries in general are very intimidating, simply because every class has so many possible attributes. Documentation is good at explaining what everything does, but not so good at helping you figure out what you need. I will be assembling the GUI dynamically, but I'm not expecting that to be the hard part. The sticking points for me right now are: How do I get text labels to size themselves automatically to the width of the contained text (so that the text doesn't clip, and I also don't reserve unnecessary space for them when resizing the window)? How do I make the vertical scrollbar always appear? Setting the VScroll property (why is this protected when AutoScroll is public, BTW?) doesn't seem to do anything. How come the horizontal scrollbar is not added by AutoScroll when contents are laid out vertically (via Dock = DockStyle.Top)? I can use a minimum size for panels to prevent the label and corresponding control from overlapping when the window is shrunk horizontally, but then the scrollbar doesn't appear and the control is inaccessible. How can I put limits on window resizing (e.g. set a minimum width) without disabling it completely? (Just set minimum/maximum sizes for the Form?) Related to that, is there any way to set minimum/maximum widths or heights without setting a minimum/maximum size (i.e. can I constrain the size in only one dimension)? Is there a built-in control suitable for hex editing or am I going to have to build something myself? ... And should I be using something else (perhaps something more capable?) I've heard WPF mentioned, but I understand that this involves XML and I really want to build a GUI from XML - I already have data in an object graph, and doing some kind of weird XML pseudo-serialization (in Python, no less!) in order to create a GUI seems incredibly roundabout.

    Read the article

  • Loading xml with encoding UTF 16 using XDocument

    - by Sangram
    Hi, I am trying to read the xml document using XDocument method . but i am getting an error when xml has <?xml version="1.0" encoding="utf-16"?> When i removed encoding manually.It works perfectly. I am getting error " There is no Unicode byte order mark. Cannot switch to Unicode. " i tried searching and i landed up here-- Why does C# XmlDocument.LoadXml(string) fail when an XML header is included? But could not solve my problem. My code : XDocument xdoc = XDocument.Load(path); Any suggestions ?? thank you.

    Read the article

  • How to return string from a button click handler?

    - by riad
    I need to return a string from a button method .How can i do that? private string folderPathButton_Click(object sender, EventArgs e) { FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); folderBrowser.ShowDialog(); string folderPath = folderBrowser.SelectedPath; return folderPath; } On that method on button click i get the folder path.Now i need to return it.But this code is not working? Can anybody help me to solve the problem??How can i return the folder path and call it from another method??

    Read the article

  • windows control library in c sharp

    - by apals
    I have just added a textbox, button, label to validate ID of 12 characters. The library is called check_ID. It works fine. The only problem is i have to access the forecolor of label, backcolor of textbox , forecolor of button as per color scheme of the project. But it seems that none of the properties of the objects in check_ID are available for modification. I have even changed the modifier to public of all objects by repoening the check_ID project. Is there another way to access the properties of these objects that are created using windows control library?. A very big thanks in advance.

    Read the article

  • problem with converting simple code from Winform to silverlight app.

    - by Sara
    Hi. I have this code for window form application and I have been attempting to convert it to a Silverlight application but it does not work!. There is a Textbox and I attached KeyDown event handler to it. when the user press the arrow key ( left or right) while the focus on the textbox, it will write . or -. When it is window form i used e.KeyCode and Keys.Right and its works great but when it is silverlight I used e.Key and key.Right and the program doesn't work good because the arrows do the 2 functions moving and write ./-. How I can work this out in Silverlight? (My English not good) The code ( window form): private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (sender is TextBox) { TextBox textBox = (TextBox)sender; if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { e.Handled = true; char insert; if (e.KeyCode == Keys.Left) { insert = '.'; } else { insert = '-'; } int i = textBox.SelectionStart; textBox.Text = textBox.Text.Insert(i, insert.ToString()); textBox.Select(i + 1, 0); } } } (and Silverlight): private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (sender is TextBox) { TextBox textBox = (TextBox)sender; if (e.Key == Key.Left || e.Key == Key.Right) { e.Handled = true; char insert; if (e.Key == Key.Left) { insert = '.'; } else { insert = '-'; } int i = textBox.SelectionStart; textBox.Text = textBox.Text.Insert(i, insert.ToString()); textBox.Select(i + 1, 0); } } } I don't understand, is there huge different effect between using Keycode/Keys and Key/Key or because something else?

    Read the article

  • How to Solve the inner Exception i.e. index out of range

    - by narmadha
    I am storing items into a combo box which had been retrieved from the database in the following manner: cmbCustomerName.DataSource = null; cmbCustomerName.DataSource = result; cmbCustomerName.ValueMember = "CustomerID"; cmbCustomerName.DisplayMember = "CustomerName"; cmbCustomerName.Text = null; Its working, but often showing the inner exception "Index Out of Range". Why does this error occur?

    Read the article

  • How can this be done with (N)Hibernate?

    - by Vilx-
    I'm creating a windows forms application with NHibernate. It's an MDI application, so there is no limit to how many forms the user can have open at the same time (probably many). For most forms I want to have an "OK" and a "Cancel" button. Both close the form, but "OK" also saves the modified data to the DB. The forms can be pretty complex, and the modifications are likely to touch a whole graph of objects, adding some, deleting some, and changing some more. It would be good if the changes could be automatically detected and persisted as needed, without the need to manually keep track of each of them. What would be a good way to do this? Extra information: I can make whatever DB schema I want. I'm using MSSQL 2008 and currently have decided for GUID primary keys (with guid.comb generator) and a TIMESTAMP column for optimistic concurrency. I tried to simply set FlushMode of a NHibernate ISession to Never, doing all modifications as needed, and then calling Flush() if the user clicked OK. But that didn't work.

    Read the article

  • Change document outline dynamically

    - by alex
    I have a code void SomeButton_Click(object sender, EventArgs e) { if (this.Controls.Contains(Panel2)) { this.Controls.Remove(Panel2); } else { this.Controls.Add(Panel2); } } My problem is: the code changes document outline order of controls on my form. How can I restore previous document outline ? What properties, methods should I use ? Or is it impossible ?

    Read the article

  • How can we extract substring of the string by position and separator.

    - by Harikrishna
    How can we divide the substring from the string Like I have string String mainString="///Trade Time///Trade Number///Amount Rs.///"; Now I have other string String subString="Amount" Then I want to extract the substring Amount Rs. with the help of second string named subString not by any other method But it should be extracted through two parameters like first is I have index no of Amount string and second is until the next string ///.

    Read the article

  • No event is firing when placing a custom data bound control in DataRepeater control in Windows forms

    - by Remo
    Hi, Custom events in a custom data bound control are not firing in DataRepeater control. When I debug it I found that the DataRepeater Control recreates the control using Activator.CreateInstance and Copies the Properties and Events. In my case copying events doesn't copy the custom events that I hooked in. For example public class MyClass : Control { public event EventHandler MyEvent; protected virtual void OnMyEvent() { if(this.MyEvent != null) { this.MyEvent(this,EventArgs.Empty); } } private int selectedIndex= -1; public int SelectedIndex { get { return this.selectedIndex; } set { if(this.selectedIndex != value) { this.selectedIndex = value; this.OnMyEvent(); } } } // // DataBinding stuff goes here // } public Form1() { InitialiseComponent(); ArrayList list = new ArrayList(); list.Add("one"); this.dataRepeater1.DataSource = list; // One Repeater MyClass test = new Myclass(); test.DataSource = GetDataTable(); this.dataRepeater1.ItemTemplate.Controls.Add(test); test.MyEvent +=new EventHandler(test_MyEvent); } // This Event should fire when selected index of Datatable is changed and is firing when placed directly in the form and not firing when place in DataRepeater control/////////////////////// private void test_MyEvent(object sender, EventArgss e) { // This event is not fired/////////////////////// } private DataTable GetDataTable() { ..// Create a data Table and return } Any help Appreciated. Thanks,

    Read the article

  • How to detect Help button press in Windows Forms MessageBox?

    - by sashaeve
    I have a message box with 3 buttons: Yes, No, Help: var result = MessageBox.Show("text", "title", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, true); I can detect if Yes/No buttons where clicked something like this: if(result == DialogResult.Yes) // some actions How I can detect that Help button was pressed and execute my own code?

    Read the article

  • Add/Edit Columns in DataBound DataGridView

    - by Dave
    I've got a datagridview that is databound from a database table. How do I: a) Edit the displayed value for a column using the values from other columns in the row? (For example, display a URL like: <a href="/url?param=columnA">columnB</a> where columnA is the value from column A and columnB is the value from columnB) b) Add an additional column using values from the other columns (similar to a.)

    Read the article

  • Images from url to listview

    - by Andres
    I have a listview which I show video results from YouTube. Everything works fine but one thing I noticed is that the way it works seems to be a bit slow and it might be due to my code. Are there any suggestions on how I can make this better? Maybe loading the images directly from the url instead of using a webclient? I am adding the listview items in a loop from video feeds returned from a query using the YouTube API. The piece of code which I think is slowing it down is this: Feed<Video> videoFeed = request.Get<Video>(query); int i = 0; foreach (Video entry in videoFeed.Entries) { string[] info = printVideoEntry(entry).Split(','); WebClient wc = new WebClient(); wc.DownloadFile(@"http://img.youtube.com/vi/" + info[0].ToString() + "/hqdefault.jpg", info[0].ToString() + ".jpg"); string[] row1 = { "", info[0].ToString(), info[1].ToString() }; ListViewItem item = new ListViewItem(row1, i); YoutubeList.Items.Add(item); imageListSmall.Images.Add(Bitmap.FromFile(info[0].ToString() + @".jpg")); imageListLarge.Images.Add(Bitmap.FromFile(info[0].ToString() + @".jpg")); } public static string printVideoEntry(Video video) { return video.VideoId + "," + video.Title; } As you can see I use a Webclient which downloads the images so then I can use them as image in my listview. It works but what I'm concerned about is speed..any suggestions? maybe a different control all together?

    Read the article

  • 3-Way sorting in ultragrid

    - by M_Mogharrabi
    how can i have a ultragrid with 3-way sorting on every columns? I mean : a. Ascendiing -Indicated by default ascending SortIndicator. b. Descending- Indicated by default descending SortIndicator. c. No Sort- UnSort the column. Note: I have tried BeforeSortChanged Event but i had 2 problems: I could not get the previous column sort indicator to find out when should i disable sorting. I have got an Exception where it is saying that we can't change SortIndicator in BeforeSortChange Event

    Read the article

  • How do i convert from milliseconds to seconds units to be shown in a Label?

    - by Doron Muzar
    I have this code: private void Form1_MouseWheel(object sender, MouseEventArgs e) { if (leave == true) { if (e.Delta > 0) { if (timer1.Interval < 5000) { timer1.Interval += 1000; label2.Text = (timer1.Interval/1000).ToString(); } } else { if (timer1.Interval == 1000) { timer1.Interval -= 100; label2.Text = (timer1.Interval / 1000).ToString(); } } } } The original timer1 interval in the designer is set to 1000 milliseconds. In the mouse wheel event i did that it will show in the label2 the untis in seconds. And indeed when i move the mouse wheel up its slowing the timer and show it in seconds 1 2 3 4 5 The problem is with the second part i wanted that when its getting to 1 second or 1000 milliseconds if i will keep wheel it down it will show the units in 100 and change the timer1.interval in 100 units. So in label2 if it was on 1 second so now i will see 900 800 700 600 500 un till 100. And also the timer1 interval should be change to 900 milliseconds 800 700 600 untill 100. When its get to 100 just stop there dont keep getting under 100. The problem is with this part: if (timer1.Interval == 1000) { timer1.Interval -= 100; label2.Text = (timer1.Interval / 1000).ToString(); } Its not working at all. EDIT** My code now: if (leave == true) { if (e.Delta > 0) { if (timer1.Interval < 5000) { timer1.Interval += 1000; label2.Text = (timer1.Interval / 1000).ToString(); } } else { if (timer1.Interval > 1000) { timer1.Interval -= 1000; label2.Text = (timer1.Interval / 1000).ToString(); } else if (timer1.Interval <= 1000 && timer1.Interval > 100) { timer1.Interval -= 100; label2.Text = (timer1.Interval / (double)1000).ToString(); } } } But now if i was at 5 seconds(5000 milliseconds) now i move the wheel back down its counting 5 4 3 2 1 0 and stop on 0 It dosent show under 1 ...0.9 0.8 0.7 as it did before.

    Read the article

  • What's the best way to tell if the mouse is over a form or not?

    - by cyclotis04
    I figured out how to capture mouse clicks over the entire form, but this method doesn't translate well for MouseEnter and MouseLeave. My form layout is made up from many Panels and TableLayoutPanels so there's no all-encompassing control I can monitor events for, and obviously a MouseLeave event for a button doesn't mean the cursor left the entire form. Has anyone figured out a good way to get around this?

    Read the article

  • Confirmation before closing

    - by saeed
    Hi I am using c# .net windows form application. I have a combo box and a text box and a close window button. Now If I make any change in the combo box or textbox and click on the close window button, it should prompt the user to save the modifications.. If no modification are made ( The user will just run the application, doesnt make any modification) then it should not prompt the user. It should close directly.. How can I do this?

    Read the article

  • How to initiate an uninstall of a ClickOnce app, from within the app?

    - by dwolvin
    Can I reliably initiate the un-installation of a ClickOnce app, from within the app? In other words, I want to give the user a big "Uninstall Me Now" button on one of the forms. When a user clicks the button, I want to start the windows uninstall process for this app, and perhaps close the app. Reason: We are dead-ending a ClickOnce app and want to make it as easy to remove as it was to install. We don't want to send them down the path to "Add or Remove Programs" and risk them getting lost or distracted. Can this be done reliably?

    Read the article

  • How do I access a file share programattically

    - by Mykroft
    I have a windows forms app running on a machine that is not on a domain, that needs to be able to move a file from the local filesystem to a UNC path. I have a username and password for that path. I was wondering is there any way to do this directly with out execing the net.exe command? Ideally I wouldn't have to map a drive.

    Read the article

  • Get Relative Path to Linked Resource in C#

    - by Jason
    I have a number of linked resources (text files in this case) in a C# project I am working on. I know the resources are linked via relative path in the Resources file. Is there any way to get that relative path from within the C# code? If there isn't, what I am trying to do is to pass that resources file to an external application as a commandline argument. If I can't do it the first way (which would obviously be the easiest) any other suggestions would be much appreciated. Thanks!

    Read the article

  • Disable digit substitution

    - by Uwe
    How can I disable the digit substitution (for example for Hindi numerals instead of Arabic ones) for my application (native c++) completely? I want all the numbers displayed with 0123 instead of ???? There is an option in localization options in windows, but I don't want to change that for the user. Only for my app. Thank you!

    Read the article

  • What's the simplest way to make a scrollable list of controls with labels?

    - by Jon Cage
    Using C++/CLI and Windows Forms, I'm trying to make a simple scrollable list of labelled text controls as a way of displaying some data fields. I'm having trouble making a TableLayoutPanel scrollable - every combination of properties I've tried seems to result in some really peculiar side effects. So I have two questions: Is this the best way to do it. If it is a reasonable approach, what magic combination of settings should I apply to the table layout panel to make it play ball?

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >