1,469 Posted Topics

Member Avatar for bhagawatshinde

[QUOTE=lxXTaCoXxl;1515092]If you're just checking to see if the vertical scroll bar is enabled then you can tell the textbox to write multiple lines of text. Like: [CODE]void appLaunch() { richTextBox1.Text = "" + Environment.NewLine + "" + Environment.NewLine + "" + Environment.NewLine + "" + Environment.NewLine + "" + Environment.NewLine …

Member Avatar for bhagawatshinde
0
1K
Member Avatar for ashley11

Check out this code for comparing two arrays: [CODE] int[] array1 = { 1, 2, 3, 4, 5, 6 }; int[] array2 = { 1, 3, 4, 4, 5, 7 }; int[] newArray = null; int k = 1; for (int i = 0; i < array1.Length; i++) { if …

Member Avatar for ashley11
0
101
Member Avatar for girishsp

I strongly recommend you to switch to dataGridView - this is especially important when it comes to editing columns. ListView is so clumsy on this area. really. DGV is a far way better control. ListView is only meant to show data, not to edit it, even if its possible. And …

Member Avatar for Mitja Bonca
0
177
Member Avatar for Nevillelajru

Why would you delete whole dgv. You dont need to. If you want to delete the row, and the dgv is bound to a data source, you have to remove the row from this data source. Then will surely work. Mitja

Member Avatar for Nevillelajru
0
298
Member Avatar for bhagawatshinde

What exactly are you trying to do? Do you want to chage the state of the tick? From true to false in runtime? Because your code has no sence to checking if the tick is in both states. Just tell me what exactly would you like to do. Mitja

Member Avatar for bhagawatshinde
0
296
Member Avatar for arunair

As ddanbe said. I will only show an example: [CODE] DateTime dateNow = DateTime.Now; // I will add just an example dateTime: DateTime dateFromDataBase = new DateTime(2011, 3, 21); //comparing both dates: if (dateNow.Date == dateFromDataBase.Date) { //if both dates are equal do code in here: } else { //if …

Member Avatar for arunair
0
199
Member Avatar for seraphon
Member Avatar for shyla

This is surely again one of the school projects. You have to create a win form from console. Ok, I did your homework, and here`s the code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int intDrawersPerDesk = …

Member Avatar for shyla
0
700
Member Avatar for yousafc#

In which format do you save it? I hope not it txt. Iam affraid best solutin your be to use *.doc. But in this case you would need some additional code for Converting the cryped doc code.

Member Avatar for yousafc#
0
92
Member Avatar for 303factory
Member Avatar for 303factory
0
185
Member Avatar for pseudorandom21

Lets say you were doing C# for 3 years. But now we have to ask you, what were you doing in these past 3 years? Have you learned every single day (for at least 2-3 hours for day), or did you only occasionally used any book(s) and Visual Studio for …

Member Avatar for abelLazm
0
131
Member Avatar for ja0
Member Avatar for Kath_Fish

Man, how do I know what is "SplitItem" variable? Is this a string (which cannot be), is an array or any other collection type? PLEASE, try to paste all the code needed for us, if you want any decent help. Lets says its an array (string[]). The same goes for …

Member Avatar for Kath_Fish
0
177
Member Avatar for ashley11

What hash funstion do you mean? There is no operation with this name in Lambda Expressions. But here is an example with Intersept operator: [CODE] SortedList<int, int> s1 = new SortedList<int, int>(); for (int i = 0; i < 10; i++) s1.Add(i, i); //ADDED: 0,1,2,3,4,5,6,7,8,9 SortedList<int, int> s2 = new …

Member Avatar for Mitja Bonca
0
102
Member Avatar for NewOrder

What exactly are you trying to do? Before pasting some code here, would be nice to do some basic explanation of what is your project aobut. So we can have a clue about, and then its a way easier for us to help you out. Now I dont know what …

Member Avatar for NewOrder
0
295
Member Avatar for virendra_sharma
Member Avatar for Mitja Bonca
0
70
Member Avatar for rannamaa

You cad do it like: [CODE] string answare = "j"; bool again = (answare == "j" || answare == "J") ? true : false; [/CODE] about your issue: as ddanbe explained, (') is a type char, and I presume that variable answare is a type string ("). So these two …

Member Avatar for rannamaa
0
95
Member Avatar for Mr.BunyRabit

Hi, what kind of reports? Crystal Reports, or some else? You can find some help about Crystal Reports here (which are by best by far - in my opinion): [url]http://www.codeproject.com/KB/cs/CreatingCrystalReports.aspx[/url] [url]http://www.codeproject.com/KB/database/MySQLCrystal.aspx[/url] [url]http://www.codeproject.com/KB/cs/Dynamic_Crystal_Report.aspx[/url] Hope it helps, Mitja

Member Avatar for Mr.BunyRabit
1
107
Member Avatar for Joey_Brown

What do you mean with radion buttons direstions? YOu have only one "main textBox" so how will you be using these 2 radionbuttons? What would be the difference in selecting one or the other? Mitja

Member Avatar for Mitja Bonca
0
113
Member Avatar for AngelicOne

Would you mind showing the code? The problem is becuase you have already opened the dataReader. For sure you have a loop and you are trying to open already opened dataReader. Double check the code, if you do not find an error, please paste the code in here. Mitja

Member Avatar for OnePostWonder
0
96
Member Avatar for Kath_Fish

[CODE] string writetext = ListItemCom2.SelectedItems.ToString(); [/CODE] Is the error. You want to get an array and put it into a stirng. No go. You needa loop, which will go through the listBox items, like: [CODE] FileStream fs2 = new FileStream(@"C:\Users\Fish\Desktop\fyp-coding\Combine.txt", FileMode.Append, FileAccess.Write, FileShare.Write);//create text file StreamWriter sw2 = new StreamWriter(fs2, …

Member Avatar for Mitja Bonca
0
179
Member Avatar for tbanisida

Do you talk about DataTables, or do you mean table in database? In any case you surely can insert only two values (into two columns out of four columns).

Member Avatar for Mitja Bonca
0
40
Member Avatar for gunnerone

Instead of using so many ArrayList, you can use Dictionary: [CODE] public partial class Form1 : Form { Dictionary<string, ArrayList> dic; public Form1() { InitializeComponent(); comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged); CreateMain(); } private void CreateMain() { dic = new Dictionary<string, ArrayList>(); string[] array = { "bankDetails", "accDetails", "transDetails" }; foreach (string …

Member Avatar for neoic91
0
257
Member Avatar for ajinkya112

Check it out here: [url]http://www.xmlfox.com/print_datagridview.htm[/url] and here: [url]http://www.codeproject.com/KB/grid/PrintDataGridView.aspx[/url] Mitja

Member Avatar for ajinkya112
0
2K
Member Avatar for Kath_Fish

Try this code: [CODE] private void button1_Click(object sender, EventArgs e) { string path = @"C:\1\test21.txt"; if (!File.Exists(path)) { FileStream fs = File.Create(path); fs.Close(); } using (TextWriter tw = File.AppendText(path)) { foreach (string item in listBox1.Items) tw.WriteLine(item); } } [/CODE] This code addes (appends) the text from listBox to the file …

Member Avatar for Mitja Bonca
0
1K
Member Avatar for Nevillelajru

Are you inserting into database, ot selecting from it? Regarding on your code (when using ExecuteNonQuery() method) you are inserting. You have to change your format that will suit to the database` dateTime column format. You can do it like: [CODE] DateTime date = dateTimePicker1.Value.Date; string sDate = date.ToString("dd-MM-yy", System.Globalization.CultureInfo.InvariantCulture); …

Member Avatar for Mitja Bonca
0
1K
Member Avatar for hopefree

Ok, sortedList, what is the Key are Value type? Even the Linq query can deffer a lot, depending on the types. Is it somethink like: SortedList<string, string> or do you use any custom objects inside? Mitja

Member Avatar for Mitja Bonca
0
157
Member Avatar for navimir

Try using FileOpenDialog method to choose the image, and then PictureBox control to show the image inside of it: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { OpenFileDialog open = new OpenFileDialog(); open.InitialDirectory = @"C:\"; open.Filter …

Member Avatar for Mitja Bonca
0
1K
Member Avatar for pseudorandom21

DataSource is a property of some controls (like DataGridView) which is used for binding data to these Controls. The best would be to look an example: [CODE] public partial class Form1 : Form { DataGridView dgv; DataTable table; BindingSource bs; public Form1() { InitializeComponent(); dgv = new DataGridView(); dgv.Location = …

Member Avatar for Momerath
0
329
Member Avatar for lianpiau

Check out this code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); dataGridView1.AllowUserToAddRows = false; dataGridView1.Columns.Add("col1", "Column 1"); dataGridView1.Columns.Add("col2", "Column 2"); DataGridViewCheckBoxColumn column3 = AddingCheckBoxColumn(); dataGridView1.Columns.Add(column3); for (int i = 1; i < 10; i++) dataGridView1.Rows.Add(i, "Item " + i, false); } private DataGridViewCheckBoxColumn AddingCheckBoxColumn() { …

Member Avatar for lianpiau
0
2K
Member Avatar for Kath_Fish

Check this out: [CODE] SortedList<int, int> sList = new SortedList<int, int>(); int[] arrayKey = { 12, 13, 14, 23, 24, 34, 12, 13, 14, 23, 24, 34 }; int[] arrayValue = { 1, 1, 1, 1, 1, 1, 2, 3, 3, 2, 2, 3 }; for (int i = 0; …

Member Avatar for Momerath
0
182
Member Avatar for salmap

[CODE] TextBox[] tbs = new TextBox[] { textBox1, textBox2 }; decimal total = 0M; for(int i = 0; i < tbs.Lenght; i++) total += ConvertToDecimal(tbs[i].Text); [/CODE]

Member Avatar for salmap
0
141
Member Avatar for jammiedude
Member Avatar for Mitja Bonca
0
78
Member Avatar for alexdinca

In win forms, you will have to specify the new position. The human eye recognize 25 pictures for second, so you will have to move the picture 25 times per second (per few inches every move). In TimerTick event you have to execte the move. You can do your own …

Member Avatar for abelLazm
0
126
Member Avatar for Usmaan

Just one think: What will happen with characters P in your case? There are two P letters in your word, so which index will be chosen for it? This is not a good way to contiune. Just to make you think a bit better. Mitja

Member Avatar for Momerath
0
172
Member Avatar for sirko

Or this one: [CODE] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string proc = Process.GetCurrentProcess().ProcessName; Process[] processes = Process.GetProcessesByName(proc); if (processes.Length > 1) { MessageBox.Show("Application already running...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { } } [/CODE]

Member Avatar for Rynkadink
0
285
Member Avatar for AngelicOne

Do you talk about sql query or...? If so, this is it: [CODE] string query = @"SELECT * FROM MyTable WHERE StartTime >= @start AND EndTime <= @end"; //pass the parameters to @start and @end time [/CODE]

Member Avatar for Mitja Bonca
-1
56
Member Avatar for AngelicOne

Just to add to ddanbe`s post: But you need to have both instances avaliable and forms in state "Open", otherwise will be an error. You can set both Forms asd global and check if they are null whihle trying to close them: [CODE] //in form1: Form2 f2; Form3 f3: Form1() …

Member Avatar for AngelicOne
0
117
Member Avatar for Arjun_Sarankulu

Try this one: [CODE] string path = @"C:\1\testFile.txt"; using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate)) { using (TextWriter tw = new StreamWriter(fs)) { //use tw variable to do writing! } } [/CODE]

Member Avatar for RobbertKeesing
0
213
Member Avatar for vedro-compota

pArray is an array of custom object, in your case the Person is a class. Array of cusom class means you have (will have) more then one Person. If there is more then one, you need to put them into an array for having them together. Mitja

Member Avatar for vedro-compota
0
142
Member Avatar for virusisfound

When you open form2, pass a parameter of dateTimePicker (a value of it) in constructor to form2. So now you have both values on forms. You only get a value of dateTimePicker from form2 and compare them.

Member Avatar for virusisfound
0
110
Member Avatar for ChrisHunter

You can see from the exception, that your conversation is not ok. Try to do: [CODE] DateTime dateDate = Convert.ToDateTime(reader["dtFrom"]); //column "dtFrom" has to be type of DateTime! [/CODE] but as it seems from your excetion, your column "dtFrom" is a type of varchar (so string, and no DateTime). So …

Member Avatar for ChrisHunter
0
181
Member Avatar for shyla
Member Avatar for xxxtian

Take a look at this code I made some days ago. It gets the images from DB into ImageList: [CODE] List<ImageList> list; public Form1() { InitializeComponent(); } private void buttonLoad_Click(object sender, EventArgs e) { list = new List<ImageList>(); using (SqlConnection sqlConn = new SqlConnection("connString")) { string query = String.Format(@"SELECT PictureName, …

Member Avatar for xxxtian
0
188
Member Avatar for hery

damn, what a mess. Why dont you use stored procedure? You will get rid of these looong code. And some work on optimizing the sql query will surely do the trick. I cannot even see what is all about this strange query, so hard to tell what cound be wrong …

Member Avatar for hery
0
904
Member Avatar for virusisfound

You mean not to get values into dataTable? Something like using DaraReader? [CODE] private void GetDataDirectly(int id) { using (SqlConnection sqlConn = new SqlConnection("connectionString")) { string query = @"SELECT a, b ,c FROM MyTable WHERE IdTable = @id"; SqlCommand cmd = new SqlCommand(query, sqlConn); cmd.Parameters.Add("@id", SqlDbType.Int).Value = id; using (SqlDataReader …

Member Avatar for virusisfound
0
134
Member Avatar for asha2009
Member Avatar for Kath_Fish

Why you dont use a Dictionary? With: [CODE] Dictionary<int, List<int>> dic; //1st part is a key, 2nd part (generic list) are values [/CODE]

Member Avatar for Kath_Fish
0
407
Member Avatar for sheennave

Hi, would you mind pasting some of the code in here? So we can see what is going wrong? thx Mitja

Member Avatar for sheennave
0
212
Member Avatar for AngelicOne

Check this code I did a couple of weeks ago. The pictues are retreived from DB and shown in listbox: [CODE] List<ImageList> list; public Form1() { InitializeComponent(); } private void buttonLoad_Click(object sender, EventArgs e) { this.listBox1.Items.Clear(); list = new List<ImageList>(); using (SqlConnection sqlConn = new SqlConnection(connString)) { string query = …

Member Avatar for AngelicOne
0
3K

The End.