1,469 Posted Topics

Member Avatar for bhagawatshinde

You would have to add a DataGridViewRadioButtonColumn, either in designmode or at runtime. Use the CustomDataGridView instead of the DataGridView when you design the form. [CODE] public class DataGridViewRadioButtonColumn : DataGridViewTextBoxColumn { internal const int radioButtonSize = 14; public DataGridViewRadioButtonColumn() :base() { this.ReadOnly = true; } internal static void Paint(Graphics …

Member Avatar for bhagawatshinde
0
2K
Member Avatar for hg_fs2002

You can do: [CODE] string query1 = @"update trainn set Adultno=Adultno-1 where ID=@pram1 and adult=@pram2 and Adultno>0"; string query2 = @"update trainn set childno=childno-1 where ID=@pram1 and child=@pram2 and childno>0"; string[] queriesArray = new string { query1, query2 }; foreach(string query in queriesArray) { sqlCmd = new SqlCommand(); sqlCmd.Connection = …

Member Avatar for hg_fs2002
0
104
Member Avatar for yousafc#

Do you want to create a DataBase out of these data? I think it would be good, and then create some classes, like Student, Class, and so on if needed. It would still be good if you tell us more what are you trying to do, a complete application for …

Member Avatar for yousafc#
0
97
Member Avatar for pseudorandom21

So create a new table, and inside of it create some columns: AbsenceID, StudentFK, Date. This means each row will have its only id (primary key), foreign key to the Students table, and an actual absendce date. So you will have this kind of structure: [CODE] Student: StudentID, Name, Age,... …

Member Avatar for Mitja Bonca
0
92
Member Avatar for KushMishra

LOL, there is no such thing! Sorry, you came on the wrong place. Best way to get knowledge is to try to use it in practice. SO has a plenty of questions about C# books/sites/tutorials. Learning pattern is really simple: read a little bit of information on C# and try …

Member Avatar for CsharpChico
1
163
Member Avatar for symeramon

Do you get any data into DataTable? Use a break point, hover the mouse ovher "dat" variable, and click on Magnifying glass to see if there is any data inside. If its not, your query is not corrct, or database is empty. Check that 1st.

Member Avatar for symeramon
0
203
Member Avatar for jmurph333
Member Avatar for jmurph333
0
233
Member Avatar for dawsonz

hi, yes it would be good if you explain this a bit better. I have a few ideas of what do you want, but I will not go and describe all here now. So..

Member Avatar for dawsonz
0
204
Member Avatar for Arjun_Sarankulu

Yes, you have to clear dataSet (or dataTable in case if you dont have dataSet).

Member Avatar for Mitja Bonca
0
156
Member Avatar for ctsmith84

Hi, you can check it [URL="http://www.daniweb.com/software-development/csharp/threads/361478"]here[/URL]. And btw, if you figure it out, can you please share your working code with us? thx in advance.

Member Avatar for CsharpChico
0
609
Member Avatar for CeeGee

Momerath is saying you cannot multiply some double value with double array value. No go. You have this code: [CODE]double [] perminuterate = { 0.07, 0.10, 0.05, 0.16, 0.24, 0.14 };[/CODE] What are these numbers mean? And you have to select ONLY one value from this double array to multiply …

Member Avatar for ddanbe
0
706
Member Avatar for Doughng

I would rather suggest you to use generic list<T>. But if you insist uisng string array, you can do it in this way too: [CODE] string[] array = new string[7]; //reading port and fill the array! //then you can do: string delimiter = ";"; //and write to a file: string …

Member Avatar for Mitja Bonca
0
237
Member Avatar for de Source

As Momerath said, please tell us what do you want to have in textBoxes, otherwise here is a simple example of a textBoxes array and a loop to insert text into them: [CODE] TextBox[] tbs = new TextBox[] {textBox1, textBox2, textBox3 }; //put all of them in here! //then loop: …

Member Avatar for de Source
0
1K
Member Avatar for leo88

Where do you have: [CODE]SqlConnection sqlConn = new SqlConnection("connString");[/CODE] amd for to Read data, you have to opean a connection as well: [CODE]sqlConn.Open();[/CODE] And its good to close it on the end of the code (or use "using" keywords instead).

Member Avatar for leo88
0
295
Member Avatar for jay_el_em

YOu have to set some more parameters, like position (Location), size (if necessary), name, ...: [CODE] //inside click event handler string submitWord = tempWord; Label lbl = new Label(); lbl.Name ="label1"; lbl.Text = submitword; lbl.Location = (20, 20); //set your location lbl.AutoSize = true; flowLayoutPanel.Controls.Add(lbl); [/CODE]

Member Avatar for jay_el_em
0
136
Member Avatar for Jessurider

You have to define which value to put into an array. This is happening in 12. row of your code. Try to change the code into: [CODE] Console.WriteLine("enter the limit:"); int n = int.Parse(Console.ReadLine()); int[] str = new int[n]; for (int i = 0; i < n; i++) { str[i] …

Member Avatar for ddanbe
0
115
Member Avatar for marcux

The code looks ok to me. What values do you have in origianl array? Just one thing to clear it out: If you have two arrays declared on the class level, then you do not need to use return and creating other arrays in methods inside of this class. Because …

Member Avatar for JamesCherrill
0
134
Member Avatar for Mike Bishop

As said, use Math.Round method. 1st parameter in this method in the actual value you want to round, while 2nd parameter is the number of decimals. If you will do as Luc001 showed, will do just fine or: [CODE] Dim dValue As Decimal = 0D If Decimal.TryParse(textBox1.Text.Trim(), dValue) Then textBox2.Text …

Member Avatar for Luc001
0
123
Member Avatar for apanimesh061
Member Avatar for de Source
Member Avatar for Mitja Bonca
0
176
Member Avatar for dotancohen

One of the possibilities is to use TextChanged event handler: [CODE] private void textBox1_TextChanged(object sender, EventArgs e) { string lastChar = textBox1.Text.Substring(textBox1.Lenght -1, 1); if(lastChar == " ") { MessageBox.Show("User has just pressed spaceBar."); } } [/CODE] Or use can use KeyPress event, where you will get the last character …

Member Avatar for Mitja Bonca
0
145
Member Avatar for BleepyE

Ok, I did the whole code you wanted. The code can Export and Import data from CS file. It even creates columnHeader text: [CODE] Public Partial Class Form1 Inherits Form Public Sub New() InitializeComponent() 'creating columns: dataGridView1.Columns.Add("col1", "Id") dataGridView1.Columns.Add("col2", "Name") 'allowing that user can add new rows: dataGridView1.AllowUserToAddRows = True …

Member Avatar for kvprajapati
0
3K
Member Avatar for rootchord

Change this method to: [CODE] private void AddListBoxItem(object item) { if (this.ConvBox.InvokeRequired) this.ConvBox.Invoke(new AddListBoxItemDelegate(AddListBoxitem), new object[] {item}); else this.ConvBox.Items.Add(item); } [/CODE]

Member Avatar for samueal
0
1K
Member Avatar for moone009

Try it this way: [CODE] For i As Integer = 0 To ListBox1.Items.Count - 1 Dim lstitem As String = ListBox1.SelectedItem.ToString() Dim sqlQuery As String = "UPDATE laitemtype SET IsActive = @active WHERE itemtypedescription=@lst" Dim cmd6 As New SqlCommand(sqlQuery, Con) 'I hope oyu have created a new instance of SqlConnection …

Member Avatar for NETProgrammer
0
2K
Member Avatar for DaemonToad3

Exactly. In your particular case you do: [CODE] this.Controls.Add(TxBxArray[i]); [/CODE]

Member Avatar for DaemonToad3
0
121
Member Avatar for deva.v

Check for them here: [URL="http://www.connectionstrings.com/"]http://www.connectionstrings.com/[/URL]

Member Avatar for deva.v
0
770
Member Avatar for Chair

This will do it: [CODE] public partial class Form1 : Form { Label[] lbls; public Form1() { InitializeComponent(); char[] letters = Enumerable.Range('A', 'Z' - 'A' + 1).Select(i => (Char)i).ToArray(); lbls = new Label[letters.Length]; int x = 20; int y = 20; for (int i = 0; i < letters.Length; i++) …

Member Avatar for Chair
0
9K
Member Avatar for JayWeb

You are doing incorrect update statement. On the right side of the equl mark you have the parameter, which you then have to specify in the command, like: [CODE] var cmd = new OleDbCommand("UPDATE Resources SET Image= @a WHERE ResourceName= @b", conn); cmd.Parameters.Add("@a", OleDbType.VarChar).Value = listView.SelectedItems[0].Tag; cmd.Parameters.Add("@b", OleDbType.VarChar).Value = _username; …

Member Avatar for JayWeb
0
101
Member Avatar for WildBamaBoy
Member Avatar for WildBamaBoy
0
535
Member Avatar for leo88

Hi, take a look at here how this has to be done: [url]http://www.dotnetspider.com/resources/5069-Writing-DataTable-into-text-file.aspx[/url]

Member Avatar for Mitja Bonca
0
233
Member Avatar for localp

[CODE] public partial class Form1 : Form { Timer timer1; Button[] btns; public Form1() { InitializeComponent(); timer1 = new Timer(); timer1.Interval = 1000; timer1.Tick += new EventHandler(timer1_Tick); timer1.Start(); //create an array of buttons: btns = new Button[] { button1, button2, button3 }; } protected override void OnShown(EventArgs e) { //set …

Member Avatar for Mitja Bonca
0
222
Member Avatar for tom_289

This is the parameter you have issues, right?: [CODE]da.Parameters.Add("@Available", SqlDbType.Bit).Value = textBox7.Text;[/CODE] Bit can only have "true" or "false" values in th database. What is your value in textBox7? Its you have 1 or 0 do a conversation to true or false. EDIT: and instead of textBox6, in which you …

Member Avatar for jignesh kaila
0
222
Member Avatar for rminator

You dont need to use StringBuilder class as array. You can simple do: REMEBER: before putting bytes into stirng, you will have to convert it, otherwise you will not get the correct result!! [CODE] private string Byte_To_Hex_Ar(Byte[] data) { StringBuilder sb = new StringBuilder(); foreach (byte b in data) { …

Member Avatar for oredigger
0
4K
Member Avatar for FELIGO

Is maybe this what you have been looking for: [CODE] int[,] array = new int[2, 4] { { 1, 2, 3, 4 }, { 1, 2, 3, 4 } }; List<int> list = new List<int>(); for (int i = 0; i < array.GetLength(1); i++) { int sum = 0; for …

Member Avatar for Mitja Bonca
0
108
Member Avatar for vehpurple

He is going to some Informatics school He has no other obligations (but I mean real obligations, not some strange sport activity) And he has no time for HIS school project which should be on 1st place of all orders. Strange is this world today! But it sure wasn`t in …

Member Avatar for vehpurple
0
2K
Member Avatar for tunlinaung

Hi, try it this way: [CODE] public class testing { delegate void mydelegate(string msg); public void btnStart_Click(object sender, EventArgs e) // Click Event { ThreadStart ts = new ThreadStart(StartServer); Thread t = new Thread(ts); t.Start(); } public void StartServer() { str = "Hello"; function1(str); } public void function1(string str) { …

Member Avatar for tunlinaung
0
293
Member Avatar for galhajaj

YOu didnt start coding the correct way. You have to put buttons into an array, and loop through them and create a common event for them, like this: [CODE] //on form load on in constructor: Button[] btns = new Buttons[]{button1, button2, button2, button4, button5, button6, button7, button8 }; foreach(Button btn …

Member Avatar for galhajaj
0
217
Member Avatar for leo88

Does your DataTable get filled up with data from dataBase? Use a break point to "stop" the code, and then go with F11 key forward row by row, and with hovering mouse over some value (varible), you will see if there are data inside of it).

Member Avatar for Mitja Bonca
0
95
Member Avatar for vincezed

Hi, you can do it this way: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); listView1.Columns.Add("column 1", -2, HorizontalAlignment.Left); listView1.Columns.Add("column 2", -2, HorizontalAlignment.Left); listView1.View = View.Details; PopulateListView(); } private void PopulateListView() { DataTable table = GetDataFromDB(); for (int i = 0; i < table.Rows.Count; i++) { …

Member Avatar for vincezed
0
190
Member Avatar for Chair

Here: [CODE] private void Form5_Load(object sender, EventArgs e) { DataGridViewComboBoxColumn cmbcolumn = new DataGridViewComboBoxColumn(); cmbcolumn.Name = "cmbColumn"; cmbcolumn.HeaderText = "combobox column"; cmbcolumn.Items.AddRange(new string[] { "item1", "item2", "item3" }); //here you can even use dataBinding! dataGridView1.Columns.Insert(1, cmbcolumn); //or add: dgv.Columns.Add(cmbcolumn); dataGridView1.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing); } private void dataGridViewEkipe_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) …

Member Avatar for Chair
0
4K
Member Avatar for TheWickedPanda

How about doing game in C#? I did some simple games, like card games, but I would like to do something bigger. A real game. Is C# appropriate?

Member Avatar for yadavarun
0
143
Member Avatar for rminator

Would you mind writing the question in words? So we can all understand what are you trying to do?

Member Avatar for abelLazm
0
460
Member Avatar for judithSampathwa

If you have a login, I assume you use a database, where you save users name and passwords (and other informations). If so, you can create a new column in the Users table, which will save the information about "[I]saving user`s name[/I]". You need only two states - true, or …

Member Avatar for C#Jaap
0
2K
Member Avatar for deathmeat

Hi, I didnt get you well. You need to create a NEW folder some where on hdd to store your dataBase inside of it, Am I right?

Member Avatar for Mitja Bonca
0
98
Member Avatar for alam14_mist

try changing the connect string of ConfigurationManager to: [CODE]string connect = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;[/CODE] All the rest stays the same. If the connection string is correct, this has to work.

Member Avatar for alam14_mist
0
139
Member Avatar for virendra_sharma

Here, I did the code you would like to have. There is maybe some work to be done in the cell vadidating (data validation; if email and tel.number are correct), and this is about it. When you do some changes, you press one button, and all it saves automatically (or …

Member Avatar for virendra_sharma
0
1K
Member Avatar for buster2209

You cannot access to AppendText or any property of TextBox over threads. You will have to use delegates to access to it on controls, not on your do, while loop: [CODE] namespace sync { public partial class Form1 : Form { int s = 0; delegate void MyDelegate1(string msg); delegate …

Member Avatar for Mitja Bonca
0
138
Member Avatar for pallabiboro

Hi, does the code of adding new row to the dataTable works? I think it does, the code you posted looks ok. Would you mind posting the whole code, including SELECT sql statement?

Member Avatar for pallabiboro
0
81
Member Avatar for virendra_sharma

If there is really alot of data, which will be a time consuming action, you can create a new thread (or use BackGroundWorker, which is a new thread too), and use Sort method: [CODE] string [] array = {"some values in array"}; Array.Sort(array);[/CODE]

Member Avatar for pseudorandom21
0
1K
Member Avatar for aplee

You will have to use delegates to update the Text property of the label1. Because you want to access from another thread to the main one and update the label`s Text property, you get this error. You can do it like this: [CODE] //delegate void MyDelegate(string message); private void MyMethod(string …

Member Avatar for Mitja Bonca
0
232

The End.