205 Posted Topics

Member Avatar for Nulty

Have a look here: [url]www.farooqazam.net/c-sharp-auto-click-button-and-auto-fill-form[/url] Thanks

Member Avatar for farooqaaa
0
68
Member Avatar for bbman
Re: XML

Import "System.Xml" namespace first: [icode]using System.Xml;[/icode] And use this code to get the item name/id: [CODE] XmlDocument doc = new XmlDocument(); doc.Load("C:\\xml.txt"); XmlNodeList list = doc.GetElementsByTagName("item"); int id = 0; string name = string.Empty; foreach (XmlNode node in list) { id = int.Parse(node["id"].InnerText); name = node["name"].InnerText; Add(id, name); } [/CODE]

Member Avatar for bbman
0
83
Member Avatar for Zinderin

You can't call class members without making an instance of it. Try adding a constructor to AppUtils class and instantiating all the array elements there: [CODE] public static class AppUtils { public static MyDogClass[] myDogs = new MyDogClass[30]; [B] static AppUtils() { for (int i = 0; i < myDogs.Length; …

Member Avatar for Lusiphur
0
149
Member Avatar for sadhawan

Why don't you use a method instead of a class? Add this above [I]public Form1() { ...[/I] [CODE] string FilterText(string text) { // do all the filtering here } [/CODE] And you can use it like this: [CODE] string text = "Hello, World."; text = FilterText(text); [/CODE] Thanks

Member Avatar for Medalgod
0
83
Member Avatar for hunfa

Add a braces before "private OracleDataReader GetDr(String sqltext, String ConnectionString)"

Member Avatar for Lusiphur
0
73
Member Avatar for virusisfound

Check my post at this thread: [url]http://www.daniweb.com/forums/post1201961.html#post1201961[/url] Thanks

Member Avatar for lotrsimp12345
0
273
Member Avatar for virusisfound

Here's a nice one: [url]http://www.csharp-examples.net/inputbox/[/url] Example use: [CODE]// this will hold the value retrieved from the input box string value = string.Empty; DialogResult result = InputBox("Username prompt", "Please enter your username:", ref value); if(result == DialogResult.OK) { MessageBox.Show(value); }[/CODE]

Member Avatar for virusisfound
0
709
Member Avatar for xpentor

Open "Program.cs" file and add this line above "Application.Run(new Form1());": [icode]Application.EnableVisualStyles();[/icode] The reason everything is looking old-fashioned is because you haven't enabled VisualStyles.

Member Avatar for xpentor
0
140
Member Avatar for zack_falcon

You should use Image.FromFile(): [CODE]btnA1.Image = Image.FromFile("G:/MCL/IT126L/CircuitCreator/CircuitCreator/bin/Debug/btnWhiteBack.png"); [/CODE] Thanks

Member Avatar for Geekitygeek
0
211
Member Avatar for gidireich

I recommend this free book: "What the C or C++ Programmer Needs to Know About C# and the .NET Framework" [url]http://www.charlespetzold.com/dotnet/index.html[/url]

Member Avatar for Zinderin
0
163
Member Avatar for Nivass

It is going to be a little hard. Have a look here: [url]http://www.codeproject.com/KB/graphics/RectangleResizable.aspx[/url] Thanks

Member Avatar for Nivass
0
140
Member Avatar for kibr987

Have a look at this tutorial: [url]http://www.farooqazam.net/draw-a-rectangle-in-c-sharp-using-mouse/[/url] And this thread: [url]http://www.daniweb.com/forums/post1259552.html#post1259552[/url] Thanks

Member Avatar for Lusiphur
0
116
Member Avatar for AngelicOne

By using [icode]Main Main = new Main();[/icode], you've made a new Main form. It doesn't hold reference to the other open Main form. You are trying to close both forms which will close the application. So better use [icode]Application.Exit();[/icode]: [CODE] if (dlgResult == DialogResult.Yes) { Application.Exit(); return; } [/CODE]

Member Avatar for AngelicOne
0
345
Member Avatar for Pokenerd

That is not the right way. You can put the code in Form_Shown event and it'll work, but the rectangle will be erased if the form is minimized, resized etc. The correct way is to use Form_Paint event. Change the drawPoint() method and add a new parameter for Graphics: [CODE]private …

Member Avatar for ddanbe
0
348
Member Avatar for VBNick
Member Avatar for xuele91

Trying casting it to [i]Screen[/i]: [CODE] public override void touchDown(float x, float y) { if (playbutton.isWithin(x, y)) { playbutton.touchDown(); ScreenManager.screenManager.addScreen((Screen)new ScreenPuzzleSelection(), 1); } if (helpbutton.isWithin(x, y)) { helpbutton.touchDown(); ScreenManager.screenManager.addScreen((Screen)new ScreenHelp(), 1); } if (exitbutton.isWithin(x, y)) { exitbutton.touchDown(); ScreenManager.screenManager.addScreen((Screen)new ScreenSplashExit(), 0); } }[/CODE]

Member Avatar for farooqaaa
0
182
Member Avatar for sadhawan

Use a generic list instead: [CODE] List<string> subj = new List<string>; for (int f = 1; f <= dir.Length; f++) { Match o = Regex.Match(txt1, "section_title='(?<TITLE>.*)'"); subj.Add(o.Groups[1].Value); } } } [/CODE] Thanks

Member Avatar for kvprajapati
0
694
Member Avatar for judithSampathwa

Textbox supports Ctrl+C and Ctrl+V by default. Do you mean to copy the text of the textbox without selecting them?

Member Avatar for Radical Edward
0
3K
Member Avatar for Wingzx20

Here's an example: Add a class-level bool variable, i.e declare it above "public Form1() { ....": [CODE][B]bool blink = false;[/B] public Form1() { InitializeComponent(); }[/CODE] Add a timer and 2 buttons to your form. Name the first button "Start" and other "Stop". Add click event for both buttons and use …

Member Avatar for Diamonddrake
0
520
Member Avatar for goal
Member Avatar for litlemaster

Check these links: [url]http://www.dotnetspark.com/kb/1218-beginners-guide-to-delegates-c-sharp.aspx[/url] [url]http://compilr.com/index.php/forum/view-postlist/forum-8-cnet-tutorials/topic-22-beginners-guide-to-delegates[/url] Thanks

Member Avatar for farooqaaa
0
87
Member Avatar for GAME

You should use ILMerge to merge the dll(s) with the .exe file. ILMerge is a console application. But here's an unofficial application with GUI that's pretty easy to use: [url]http://ilmergegui.codeplex.com[/url] Thanks

Member Avatar for GAME
0
150
Member Avatar for madoverclocker
Member Avatar for GAME

Pass "null" as an argument. Edit Program.cs: [CODE]Application.Run([B]new Form1(null)[/B]);[/CODE] And before assigning the "F" variable, check if its not a null: [CODE]if (F != null) form8 = F;[/CODE] Thanks

Member Avatar for GAME
0
142
Member Avatar for judithSampathwa
Member Avatar for judithSampathwa
0
71
Member Avatar for judithSampathwa

You should remove the "$" sign from the text. And also, it is recommended to use Decimal data type for Money. To remove the "$" you can use [I]Replace()[/I] method: [CODE]command.Parameters.Add("@tamt", SqlDbType.Money).Value = [B]Decimal[/B].Parse(Amt.Replace("$", string.Empty); command.Parameters.Add("@oamt", SqlDbType.Money).Value = [B]Decimal[/B].Parse(OAmt.Replace("$", string.Empty);[/CODE] Thanks

Member Avatar for judithSampathwa
0
430
Member Avatar for domingo

[I]Equals()[/I] method won't work for Image unless you are checking which object is it pointing to. A solution for your problem is: Declare the error image as a class-level variable (i.e declare it above public Form1() {.....): [CODE] Image errorImage = Image.FromFile("..\\..\\Images\\tbl9.jpg"); [/CODE] Now when you are assigning the error …

Member Avatar for domingo
0
111
Member Avatar for Dr-Delta
Member Avatar for farooqaaa
0
101
Member Avatar for darkseid

I don't get what you are trying to achieve. Read this article about Drag and Drop: [url]http://msdn.microsoft.com/en-us/library/Aa289508[/url] Thanks

Member Avatar for farooqaaa
0
222
Member Avatar for SBA-CDeCinko
Member Avatar for sdhawan

You can do it like this: [CODE]SqlCommand cmd = new SqlCommand("INSERT INTO table (richTxt) VALUES('" + richTextBox1.Text + "')"); cmd.ExecuteNonQuery();[/CODE] Thanks

Member Avatar for sdhawan
0
92
Member Avatar for spach79

You should store the "1,2,3...." in an array and then use [I]AddRange()[/I] to add it to the comboBox: [CODE] [B]string[] numbers = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; [/B] for (int i = 0; i < count; i++) { creditHours[i] = new ComboBox(); [B]creditHours[i].Items.AddRange(numbers);[/B] …

Member Avatar for spach79
0
637
Member Avatar for Martin.S

The reason it returned "4" instead of "0" was because when you entered "70". It was smaller than "73" so sCategory was assigned "0". But it is also smaller than "95" which made sCategory "1". The next if statement made it "2" because it is also smaller than "110" and …

Member Avatar for Martin.S
0
95
Member Avatar for eXceed69
Member Avatar for Ms.passion

You have added an unexpecting comma ',' after [icode]& txtmsg.Text & "'[/icode]. Try removing that. [CODE] sql = "Insert into contact (fname, email, msg) values ('" & txtname.Text & "', '" & txtmail.Text & "', '" & txtmsg.Text & "')" [/CODE]

Member Avatar for Ms.passion
0
202
Member Avatar for bbman
Member Avatar for farooqaaa
0
42
Member Avatar for forneamax

I am not sure but I've tried something that seem to work: Set your webBrowser Uri to "about:blank" (or use any other url you want). And add "DocumentComplete" event for your webBrowser. Add this to the DocumentComplete event: [CODE] webBrowser1.Document.MouseUp += new HtmlElementEventHandler(Document_MouseUp); [/CODE] Put a MessageBox (for testing) inside …

Member Avatar for bbman
0
2K
Member Avatar for bbman

The GetPixel() method is better. Because it won't read all the pixels if there's a difference while the other method will always read both the files.

Member Avatar for bbman
0
146
Member Avatar for basma.lm
Member Avatar for Ketsuekiame
0
143
Member Avatar for JOSheaIV

When you are adding a single item (not an array) use [I]Add()[/I] and when you are using an array use [I]AddRange()[/I]. Working version of your code: [CODE] string transfer = shiftTypeIn[0]; checkedListBox1.Items.Add(transfer) string transfer2 = shiftTypeIn[1]; checkedListBox1.Items.Add(transfer) [/CODE] Thanks

Member Avatar for JOSheaIV
0
3K
Member Avatar for trippinz

Use this: [CODE] if(buttonX4.InvokeRequired) { this.Invoke((MethodInvoker)delegate() { buttonX4.Text = "Copy To Clipboard"; }); } [/CODE]

Member Avatar for trippinz
0
708
Member Avatar for elliot81

You should add a new class [I]Person[/I] and use a generic list. Here's an example: [CODE] using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication { class Program { static void Main(string[] args) { [B]List<Person> people = new List<Person>();[/B] string salary, pno, pcode, state, addr, strno, name; Console.WriteLine("enter salary:"); salary = …

Member Avatar for kvprajapati
0
132
Member Avatar for judithSampathwa

Set "EditMode" for the datagridview to "EditProgrammatically". Use this for the "Edit" button: [CODE] dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2; [/CODE] If you have a "Read Only" button the use this: [code] dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically; [/code] Thanks

Member Avatar for judithSampathwa
0
174
Member Avatar for sadaf K

Hello Sadaf, Here's an example: Use this when opening Form2: [CODE] Form2 form2 = new Form2(textBox1); form2.Show(); [/CODE] Edit form2 and make it like this: [CODE] TextBox txtBox; public Form2(TextBox txtBox) { InitializeComponent() this.txtBox = txtBox; } // Now you can get form1's textbox text like this private void button1_click(object …

Member Avatar for sadaf K
0
73
Member Avatar for judithSampathwa

[QUOTE=;][/QUOTE] You have used "1" as the starting index in the for loop. You should use "0". Try this: [code] for (int r = 0; r < dt.Rows.Count; r++) { ..... }[/code] Thanks

Member Avatar for farooqaaa
-1
111
Member Avatar for judithSampathwa

Add "FormClosing" event to your form. And use this code: [CODE]private void Form_Closing(object sender, FormClosingEventArgs e) { // Remove these 2 lines if the current form is not the default form of your application. e.Cancel = true; this.Hide(); LoginForm loginForm = new LoginForm(); loginForm.Show(); }[/CODE] Thanks

Member Avatar for judithSampathwa
0
118
Member Avatar for Exaktor

Use this: [CODE] int i = (int)dataGridView1.Rows[e.RowIndex].Cells["yourUniqueID"].Value; [/CODE] Thanks

Member Avatar for Exaktor
0
349
Member Avatar for jamdownian

If the login windows is the default Form of your application then you should hide it. Because if you close it it'll close the application. Here's an example: [CODE] if (userName_login_window.Equals("1") && pass_login_window.Equals("2")) { MainWindow window = new MainWindow(); window.ShowDialog();//Brings up the main window [B]this.Hide();[/B] } [/CODE]

Member Avatar for jamdownian
0
115
Member Avatar for PDB1982

The problem might be with the [I]arr(i)[/I] values. Have you tried checking what those values (X & Y) returns?

Member Avatar for Luc001
0
181
Member Avatar for sjn21682

Here's an example: [B]MainForm:[/B] [CODE] // Make it "public" so we can access it from LoginForm public bool loggedIn = false; LoginForm form2; public MainForm() { InitializeComponent(); } private void MainForm_Load(object sender, EventArgs e) { // Disable the menuStrip menuStrip1.Enabled = false; // Initialize Form2 and pass "MainForm" as an …

Member Avatar for sjn21682
0
105

The End.