205 Posted Topics
Re: I agree with you. I also faced the same problem. This cool new design is making ugly problems. :X | |
Re: You should save the default image of the picturebox and then use that image every time you draw graphics. I mean like this: [CODE] // Class-level variables Image defaultImage, gImage; public Form1() { InitializeComponent(); defaultImage = pictureBox.Image; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { // This will use the … | |
Re: [CODE]I would like to remove any selected item from the list box and not just the first item, which is what your solution does [/CODE] What do you mean with "any selected item"? Do you mean multiple selected items? | |
Re: You can use Array.Reverse() on a char[] array to achieve that. Here's an example: [CODE] string Reverse(string str) { char[] chars = str.ToCharArray(); Array.Reverse(chars); return new String(chars); } // Example use string text = "Some text goes here"; MessageBox.Show(Reverse(text)); [/CODE] Thanks | |
Re: [QUOTE=;][/QUOTE] The mistake you are making is that you are assigning the "rnd()" value to the TextBox's text every time the timer ticks. This code will work for you: [code] Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick [B]Dim rndInt as Integer = Int(Rnd() * 1)[/B] … | |
Re: "Id" is an attribute not a tag. That's the mistake you are making. This code will work for you: [CODE]MessageBox.Show(photo[0].Attributes["id"].Value);[/CODE] Thanks | |
Re: You can get it like this: [I]int current[/I] holds the current index number. [CODE] int current = 0; // Get the "aaaa, bbbbb ...." HtmlElement pageElement = wb.Document.GetElementById("tableid"); this.textBox1.Text = pageElement.Children[current].InnerText); // Get the "hrefs" HtmlElement href = pageElement.GetElementsByTagName("a")[current]; MessageBox.Show(hrefs.GetAttribute("href")); [/CODE] | |
Re: You've opened the connection after making the command. Try opening it before the command: [CODE] public void AddToAction() { [B]db.openConnection();[/B] String query = @"Select * from TopicAction"; SqlCommand command = new SqlCommand(query,DB.getConnection()); SqlDataReader reader = command.ExecuteReader(); SqlDataAdapter da = new SqlDataAdapter(command); DataTable dt = new DataTable(); da.Fill(dt); while (reader.Read()) { … | |
Re: You should add it to the Panel and not the Form. I mean you should use[icode]panel1.Controls.Add(pb);[/icode] instead of [icode]this.Controls.Add()[/icode] Thanks | |
Re: I've tried that code and its working fine. Why are you using a proxy? Thanks | |
Re: Because you are not changing the [I]Text[/I] of the label controls. Try something like: [CODE] ScoreX += 1 ScoreO += 1 scoreXLabel.Text = ScoreX scoreYLabel.Text = ScoreY [/CODE] Thanks | |
Re: Okay that looks a little bit confusing. But I think you can get it done like this: Firstly declare a class-level variable "ClickedLabel": [CODE] // Declare here Label ClickedLabel = null; public Form1() { InitializeComponent(); } [/CODE] Secondly add "MouseUp" event for the label OR make an event "AllLabels_MouseUp" and … | |
Re: You can either make a new EventHandler or use a delegate. This will work: [CODE] pb.Click += delegate(object s, EventArgs e2) { System.Diagnostics.Process.Start("http://www.example.com"); }; [/CODE] Thanks | |
Re: You can check it like this: [CODE] string[] ProposalNumbers = getProposalNumbers(); if (ProposalNumbers.Length > 0) { // Array is not empty } [/CODE] Thanks | |
Re: I don't get you. If you don't want to show Form3 then simple get rid of that code: [CODE] Form3 f = new Form3(); f.Show(); [/CODE] | |
Re: You can use: [CODE] if ((string)dataGridView1.Rows[RowIndex].Cells[cellIndex].Value != string.Empty) [/CODE] | |
Re: Check your Command. You should pass the Connection as an argument. It should look like this: x = new Command("Select * From x", [B]Connection[/B]); Thanks | |
Re: Have a look here: [url]http://blogs.msdn.com/domgreen/archive/2009/09/06/comparing-two-images-in-c.aspx[/url] Thanks | |
Re: Use "InnerText" if you don't want those tags to show up: [CODE] textResult = pageElement.Children[0].InnerText; [/CODE] Thanks | |
Re: Try putting [icode]MessageBox.Show("Is this event even fired?");[/icode] to see if the event is fired or not. If the [I]MessageBox[/I] is not shown then try copying [icode]this.currency_txt.TextChanged += new EventHandler(currency_txt_TextChanged);[/icode] code to [I]public Form1() { ...(here)... }[/I]. Thanks | |
Re: You are making 2 mistakes. Firstly, you didn't save the Settings. Add this to the SaveProxies() method: [CODE] Share_Cash_Downloader_v0._2._9._5.Properties.Settings.Default.Save(); [/CODE] Secondly, you are loading the wrong settings. You are loading "Last" instead of "Proxies". Replace it: [CODE] string[] items = Share_Cash_Downloader_v0._2._9._5.Properties.Settings.Default.[B]Proxies[/B].Split(','); [/CODE] Thanks | |
Re: Also, remember to add [icode]this.Hide();[/icode] after adatapost's code to hide the login form. Do the same for form2 if you don't want to use it when form3 is shown. Thanks | |
Re: You can use: [CODE] public String[] FillComboBox() { int NoOfRows; String firstName; String lastName; db.openConnection(); DisplayLoginUserName(); String query = @"Select * From Employee;"; SqlCommand command = new SqlCommand(query, DB.getConnection()); SqlDataAdapter da = new SqlDataAdapter(command); DataTable dt = new DataTable(); da.Fill(dt); NoOfRows = dt.Rows.Count; String[] fullName = new String[NoOfRows]; for (int … | |
Re: Its pretty simple. First you'll store all the "a" tags in an HtmlElementCollection and then check each one if it StartsWith "http://www.googleads". If so, then add it to the links list. [CODE] List<string> links = new List<string>(); HtmlElementCollection col = webBrowser1.Document.GetElementsByTagName("a"); foreach (HtmlElement elem in col) { if (elem.GetAttribute("href").StartsWith("http://www.googleads")) links.Add(elem.GetAttribute("href")); … | |
Re: How does the filecontent looks like? Can you post it? | |
Re: Edit your method and use "string[]" for the method type. Also use "return fullName;" instead of "return fullname[no]" because that will return a single string and not an array. Here's the working method: [I]Changes are in bold.[/I] [CODE] public [B]string[][/B] LoadUSEmp() { String firstName; String lastName; db.openConnection(); String query = … | |
Re: Post all the code. The code you posted seems alright. | |
Re: If you don't prefer to use Regular Expressions then this will also work: It doesn't use regex. [CODE] string abc = "SMS_dr_6500"; int num = int.Parse(abc.Substring(abc.LastIndexOf('_') + 1)); [/CODE] | |
Re: If the form - that you are trying to close - is the default form. Then closing it will also close the application. You should hide it instead of closing it. Just change [icode]this.Close();[/icode] to [icode]this.Hide();[/icode] You can use this to focus the username textbox: [icode]txtUsername.Focus();[/icode] Final code with all … | |
Re: Try this: [B] Call LVW_Click(Nothing, Nothing)[/B] Thanks | |
Re: Can you post the html code for the "<img>" tag and the other tags around it? | |
Re: Have a look here: [url]http://msdn.microsoft.com/en-us/library/7tas5c80.aspx[/url] Thanks | |
Re: You can use [I]for loop[/I] like this: [CODE]for (int i = 0; i < 10; i++) { forms[i].Contorls.Add(radiobutton); }[/CODE] Thanks | |
Re: You can't make a game like that by using pictureboxes. Try using [URL="http://creators.xna.com/"]XNA Game Studio.[/URL] | |
Re: You are making one small mistake. Select your webBrowser in the designer. In the properties panel switch to "Events" and for "DoucmentComplete" event select the "webBrowser_DocumentComplete". OR you can do it via code: [CODE] webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); [/CODE] | |
Re: Use this to check if "pizzafoundboolean/stylefoundboolean" are true or not.: [CODE] ]If pizzafoundboolean And stylefoundboolean Then [B]MessageBox.Show(pricedecimal(indexinteger).ToString("C"));[/B] Me.pizzaTextBox.Text = pricedecimal(indexinteger).ToString("C") End If [/CODE] If the MessageBox() is not shown then none of them are true. | |
Re: [QUOTE]The textbox is textBox1 and Ive got a lot of code connected to it[/QUOTE] Events? or the name "textBox1" ? Thanks | |
Re: To select the text of a TextBox when it is activated by Tab key. Then add "Enter" event for the textbox and use this code: [CODE] private void textBox1_Enter(object sender, EventArgs e) { textBox1.SelectAll(); } [/CODE] And to select the text when the textBox is clicked then add a "Click" … | |
Re: Is "Form6" already open? If so, then what code did you use for opening it? And where? | |
Re: Set "AllowUserToAddRows" and "AllowUserToDeleteRows" to "False" and "EditMode" to "EditProgrammatically" to make it read only. Add "CellClick" event and use this code: [CODE] private void DGV_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() != string.Empty) form2.Show(); } [/CODE] Thanks | |
Re: Try this code: [CODE] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { int carX = 230; int carY = 230; public Form1() { InitializeComponent(); this.KeyDown += new KeyEventHandler(Form1_KeyDown); } private void Form1_Load(object … | |
Re: I don't have VB.NET installed at the moment. Anyway, try this: Change the [I]Modifiers[/I] property for the listview to "public" and then try to access it from form2 like this: [icode]Form1.listView1[/icode] An example for selecting the current selected item: [CODE]Dim selectedItem as ListViewItem = Form1.listView1.SelectedItems[0][/CODE] Thanks | |
Re: You will have to use Invoke() method when calling something outside the thread. Use this: [CODE] this.Invoke((MethodInvoker)delegate() { inTreeNode.Nodes.Add( tNode2 ); }); [/CODE] Thanks | |
Re: You didn't proved the full path of "HELLO.txt". Lets say, if its located in "C:\" then use this: If so, then use this: [CODE] FileStream(@"C:\HELLO.txt", FileMode.Open,FileAccess.Read); [/CODE] Or if its located in the same path as the executable. Then use this: [CODE] FileStream file = new FileStream(Path.Combine(Application.StartupPath, "HELLO.txt"), FileMode.Open,FileAccess.Read); [/CODE] … | |
Re: You can use Application.StartupPath: [CODE] System.Diagnostics.Process.Start("iexplore.exe", System.IO.Path.Combine(Application.StartupPath, "abc.html")); [/CODE] Thanks | |
Re: Its simple: [CODE] ElseIf Saved = True Then 'This will overwrite it RichTextBox1.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.TextTextOleObjs) Me.Text = "" & SaveFileDialog1.FileName & " - NoteEditor Pro" End If [/CODE] If the file is already saved then path is already there. Just copy the code used in "Saved = false" but only remove … | |
![]() | Re: Interesting question. Took me about 30 minutes to get this done. Here's the code: [CODE=C#] private char[,] Swap(char[] array) { // Make a list from the given char[] array List<char> fromArray = new List<char>(); foreach(char chr in array) fromArray.Add(chr); // This list will hold the new shuffled array List<char> randomList … |
Re: It can be done like this: [CODE] void CopyAll(DirectoryInfo currentDir, DirectoryInfo newDir, string fileType) { foreach (FileInfo fi in currentDir.GetFiles(fileType)) { fi.CopyTo(Path.Combine(newDir.ToString(), fi.Name), true); } foreach (DirectoryInfo subDir in currentDir.GetDirectories()) { DirectoryInfo targetDir = newDir.CreateSubdirectory(subDir.Name); CopyAll(subDir, targetDir, "*.txt"); } } [/CODE] Example Use: [CODE]CopyAll(new DirectoryInfo(@"C:\txts"), new DirectoryInfo(@"D:\newTxts"), "*.txt");[/CODE] Thanks | |
Re: Put this in the Form_Load event: [CODE] bool value = Bool.Parse([B]put that value here[/B]); if(value) { checkBox1.Checked = true; } [/CODE] Thanks |
The End.