1,469 Posted Topics

Member Avatar for dilansankalpa

Do it this way: [CODE] private void button1_Click(object sender, EventArgs e) { DateTime date = DateTime.MinValue; if (!DateTime.TryParse(textBox1.Text, out date)) { string[] strSplit = textBox1.Text.Split('/'); if (strSplit.Length == 1) date = new DateTime(int.Parse(strSplit[0]), 1, 1); else if (strSplit.Length == 2) date = new DateTime(int.Parse(strSplit[0]), int.Parse(strSplit[1]), 1); } MessageBox.Show("Real date time …

Member Avatar for Mitja Bonca
0
249
Member Avatar for moshe12007

If no parameters to pass: [CODE] //1. way: new Thread(new ThreadStart(MethodNoParams)).Start();//calling new method //2. longer way (if you need a "t" variable maybe): Thread t = new Thread(new ThreadStart(MethodNoParams)); //calling new method t.Start(); [/CODE] If parameters to pass: [CODE] object obj ="some param"; Thread t1 = new Thread(new ParameterizedThreadStart(MethodWithParams)); //calling …

Member Avatar for Mitja Bonca
0
443
Member Avatar for hszforu

int array cannot be empty. Empty is for string. Int can have only numbers. So when you initialize a new integer array all indexes set to zero This is 0 and not empty.

Member Avatar for hszforu
0
138
Member Avatar for teenshee_rosean

As charlybones said, there is 100% a problem in the connection string structure. Remove Integrated Security=True from your connection string and (optional) add Persist Security Info=True; From MSDN: Integrated Security - When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are …

Member Avatar for teenshee_rosean
0
558
Member Avatar for c++_fem

You can always use try-catch blocks to catch the exception. But in this cases of yours it seems not to need one. If your method has a return type, you have to return this type in any place in the Sum method. Otherwise the compiler will throw an error. You …

Member Avatar for c++_fem
0
234
Member Avatar for dilansankalpa
Member Avatar for dilansankalpa
0
104
Member Avatar for superjj
Member Avatar for Ayavan

So this means 2 things: - or you dont retreive the right data - or you dont have the correctly. Can we see some of your code that does these two things?

Member Avatar for Mitja Bonca
0
110
Member Avatar for zack_falcon

You can pass it into constructor of the class and use it: [CODE] class Main { Piece[,] board = new Piece[9, 8]; private void GoToMath() { //code... MathFunction mf = new MathFunction(board); //pass data to other class board = mf.DoSomeWork(); //do some work there, and return data } } class …

Member Avatar for Mitja Bonca
0
134
Member Avatar for amras123

If your DGV is data bound (so the DGV`s property DataSource is used), then all the changes made in the DGV will automatically reflect in the dataTable (or dataSet) as well. Then if you want to do updates in the database as well, you have to use Update SqlCommand. Take …

Member Avatar for Mitja Bonca
0
237
Member Avatar for x69chen

You didnt set the return type to the setLenght method. You have to change the code to: [CODE] static void Main() { int[] myArray = new int[4]; myArray = setLength(myArray, 8); } static int[] setLength(int[] myArray, int length) { Array.Resize(ref myArray, length); return myArray; } [/CODE] or you can use …

Member Avatar for Mitja Bonca
0
170
Member Avatar for jgat2011

[QUOTE=jgat2011;1671548]Hi every one! I would like to know if it's possible to have differents items in a combo box in each row. It there is way. Please help!!! Thanks[/QUOTE] Hi, you will have to do a loop through all the rows of datagrid and based on othe column set the …

Member Avatar for Mitja Bonca
0
123
Member Avatar for Behseini

You can subscribe to a KeyPress event of textbox control, and use this code: [CODE] private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != '\b') e.Handled = !System.Uri.IsHexDigit(e.KeyChar); } [/CODE] Or TextChanged event: [CODE] private void textBox1_TextChanged(object sender, EventArgs e) { string item = textBox1.Text; int n = 0; …

Member Avatar for Mitja Bonca
0
3K
Member Avatar for Mirfath

1st of all: Do not change your controls (textBox in this case) access modifier. Leave it as private (never change it to public, because this is the worst thing you can do). There ar plenty of other ways to access the control, but directly from inside the class (form) where …

Member Avatar for Mirfath
0
147
Member Avatar for bettybarnes

or: [CODE] txtDisplay.Text = txtDisplay.Text.Remove(txtDisplay.Text.Length - 1); [/CODE]

Member Avatar for Mitja Bonca
0
187
Member Avatar for prit005

try: [CODE] PictureBox[] pbs; void textBox1_TextChanged(object sender, EventArgs) { int num =0; if(int.TryParse(textBox1.Text, out num)) { pbs = new PictureBox[num]; int x = 20, y = 20; for(int i = 0; i < pbs.Lenght; i++) { pbs[i] = new PictureBox(); pbs[i].Name = "pictureBox" + (i + 1); pbs[i].Location = new …

Member Avatar for Mitja Bonca
0
136
Member Avatar for Ehtesham Siddiq

Check this out: [CODE] Private Shared Sub Main(args As String()) Dim [date] As DateTime = DateTime.Today Dim daysNames As String() = GetDaysNames([date]) 'use each day (or show it) For Each days As String In daysNames Next End Sub Private Shared Function GetDaysNames([date] As DateTime) As String() Dim daysInMonth As Integer …

Member Avatar for Mitja Bonca
0
541
Member Avatar for r_james14

[QUOTE=r_james14;1672088] bghtyhgfr5674456_120411_3215. The last four digits the time, middle set the date.[/QUOTE] How is 3215 the time?? What it represents? Seconds? Because 32hours and 15 minutes cannot be in one day!

Member Avatar for gusano79
0
94
Member Avatar for mitchiexlolz

That you dont have two databases? So, inserting on one, and looking into the other? It might occur this (at least I have a couple of issues with it).

Member Avatar for Mariandi
0
190
Member Avatar for kokila1234

Yes, to extend Chris`s code: [CODE] //in TextChanged event hander of textBox1: // string myID = Convert.ToInt32(textBox1.Text.Trim()); SqlConnection conn = new SqlConnection("connString"); SqlCommand cmd = new SqlCommand(); cmd.CommandText = @"SELECT Column1, Column2 FROM MyTable WHERE ColumnID = @param"; cmd.Parameters.Add("@param", SqlDbType.Int).Value = myID; SqlDataReader reader = cmd.ExecuteReader(); if(reader.Read()) { textBox2.Text = …

Member Avatar for Mitja Bonca
0
194
Member Avatar for Mike Askew

If it expects four digits, then its input cannot be in the form of an int. It must be a string. The number of decimal digits has no meaning in the 'int' type - it's not natively an decimal type. (It's actually a 32-digit binary type. It's just that C# …

Member Avatar for Mike Askew
0
142
Member Avatar for slightlyMad

You can create a seperate custom class which will hold the data. In any of the form you must have a reference (which has to be instantiated only one - on beginning) to this class; so you can access to the data on the class. The data can be in …

Member Avatar for slightlyMad
0
142
Member Avatar for solomon_13000

1. Do you mean one reference? If so, there is no point in this. You can simple without any harm and time consumption create a new connection reference [I](connection conn = new connection("string");[/I]. No. The command will take those data that are currently available on the server. So if command1 …

Member Avatar for Mitja Bonca
0
146
Member Avatar for dennysimon

Why you dont get the image directly out of the cell? You dont need to parse it to object. Example: [CODE] public Form1() { InitializeComponent(); //creating image column: DataGridViewImageColumn imageColumn = new DataGridViewImageColumn(); { imageColumn.Name = "colImages"; imageColumn.HeaderText = "Images"; imageColumn.Width = 100; imageColumn.ImageLayout = DataGridViewImageCellLayout.Normal; imageColumn.CellTemplate = new DataGridViewImageCell(false); …

Member Avatar for dennysimon
0
199
Member Avatar for ehrendreich

Hi, check [URL="http://www.akadia.com/services/dotnet_databinding.html"]this link[/URL]. Its all there.

Member Avatar for ehrendreich
0
143
Member Avatar for c#learner

Will this be a windows application? I did a simple example code in Console. Code simulates throwing dices by just pressing any key, and it does all you asked for. To make this a win application try to use this code, but it should be a lot easier, because you …

Member Avatar for bmc100
0
126
Member Avatar for cyberdaemon

Hi, read [URL="http://www.dreamincode.net/forums/topic/74727-more-than-one-resource-parameter-error-resolved/"]here[/URL] about it. bye

Member Avatar for cyberdaemon
0
74
Member Avatar for nmohammed

To allow letters only subscribe to KeyPress event of textbox, and put this code inside (dont copy/paste the event, just the code inside of it): [CODE] private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { //allows backspace key if (e.KeyChar != '\b') { //allows just letter keys e.Handled = !char.IsLetter(e.KeyChar); } } …

Member Avatar for nmohammed
0
204
Member Avatar for Ruchi224
Member Avatar for Ruchi224
0
187
Member Avatar for Alkis90

[CODE] //form1 private void CreateAndCopy2DArray() { string[,] arr1 = new string[170000, 2]; string[,] arr2 = new string[170000, 20]; Form2 f2 = new Forms(arr1, arr2); f2.Show(); } //form2: public Form2(string[,] arr_1, string[,] arr_2) { //use these two variables here } [/CODE]

Member Avatar for Mitja Bonca
0
91
Member Avatar for violette

Try converting data from database into soem number type, I will show you an example converting to decimal: [CODE] Dim total1 As Label = DirectCast(e.Item.FindControl("total1"), Label) total1.Text = Convert.ToDecimal(e.Item.DataItem("receivable")) * 365 / Convert.ToDecimal(e.Item.DataItem("revenue"))[/CODE] Remember, Math operations are only possible over math values (no strings involved).

Member Avatar for violette
0
93
Member Avatar for johmolan

Iam not sure what exactly you want, but you can create a class variable (type of integer) and when you get the 1st for the 1s time, asign this id to this class variable. And later simply use it. If its not in any help, please provide us some code. …

Member Avatar for johmolan
0
92
Member Avatar for AndyPants

You mean that all the letters from string1 are in string2? Is so, hericles solution will work, but partly, you need a break point of the for loop, when all indexes are reached. hericles`s code needs to be modified a bit (and in VB): [CODE] Dim s1 As String = …

Member Avatar for AndyPants
0
476
Member Avatar for bradz1993

try to use some more appropriate numeric checking (validation): [CODE] Dim intValue As Integer 'value in textBox is integer If Integer.TryParse(textBox1.Text, intValue) Then End If Dim decValue As Decimal 'value is decimal (in case if you use decimals If Decimal.TryParse(textBox1.Text, decValue) Then End If [/CODE]

Member Avatar for Unhnd_Exception
0
186
Member Avatar for gd740

You can do on a very simple way: [CODE] Private Sub textBox1_KeyDown(sender As Object, e As KeyEventArgs) If e.KeyCode = Keys.Enter Then textBox2.Text = GetData(textBox1.Text.Trim()) End If End Sub Private Function GetData(str As String) As String Dim strReturn As String = "" Select Case str Case "A001" strReturn = "My …

Member Avatar for Mitja Bonca
0
166
Member Avatar for manugm_1987

Write this query: [CODE]SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'[/CODE] For further info go [URL="http://www.mssqltips.com/tutorial.asp?tutorial=196"]here[/URL]. To get table name into comboBox, you can use dataReader class, and while looping through the database, add their names into comboBox: [CODE] string connectionString = @"yourConnStringHere"; using (SqlConnection sqlConn = new SqlConnection(connectionString)) …

Member Avatar for manugm_1987
0
350
Member Avatar for dennysimon

Try it this way: [CODE] using system; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Printing; private void Button1_Click(object sender , eventargs e) { PrintDocument pd = new PrintDocument(); pd.PrintPage+= new PrintPage(printing); pd.Print(); } void printing(object sender , PrintPageEventArgs e) { Bitmap bitmap = new Bitmap(datagrid1.width,datagrid1.height); datagrid1.DrawtoBitmpa(bitmap,datagrid1.ClientRectangle); e.Graphics.DrawImage(bitmap,new Point(50,50)); } [/CODE]

Member Avatar for dennysimon
0
403
Member Avatar for Hari835

So you have to delete whole row in database? For each row in gridview Create new command to use DELETE query statement, like; [CODE] //initialize connection.. //initialize command.. //open connection.. string query = @"DELETE FROM MyTable WHERE FileName @param"; command.Parameters.Add("@param", SqlDbType.VarChar, 50).Value = filepath; //get file file path from the …

Member Avatar for Mitja Bonca
0
91
Member Avatar for manugm_1987

Sure its possible to use Regular expressions. But you have to be specific what you have to validagte. About columns checking, do you have to check if there is the correct number of columns to suit the number of columns of dataTables (dataSet)? Best option is to use data binding. …

Member Avatar for manugm_1987
0
145
Member Avatar for mihirpatel12
Member Avatar for Netcode
0
200
Member Avatar for glut

To get the path, you have to use [I]treeView2.SelectedNode.FullPath[/I]; property. And its a bit strange to put all the files one beside another into textBox. At lease seperate them, by using some delimiter like commma: [CODE] //selected node: textBox1.Text = ReadFile(treeView2.SelectedNode.FullPath; //your method static string ReadFile(string filePath) { string ret …

Member Avatar for Mitja Bonca
0
174
Member Avatar for aadi_capri

You have to subscribe to a Click event of label control: [CODE] Public Sub New() 'constructor label1.Click += New EventHandle(AddressOf label1_Click) End Sub Private Sub label1_Click(sende As Object, e As EventArgs) MessageBox.Show("label clicked.") End Sub [/CODE]

Member Avatar for Mitja Bonca
0
89
Member Avatar for manugm_1987
Member Avatar for Alkis90

Compare both texts to "ToLower": [CODE] if (text.Contains(arr[x, 0].ToLower())) { text = text.Replace(arr[x, 0], arr[x, 1]); } [/CODE]

Member Avatar for Alkis90
0
261
Member Avatar for niño_morata

You mean that only one click on a button is allowed to do the command, if there is more then one click, the message will appear?

Member Avatar for jeffrey blanz
0
105
Member Avatar for nssltd

hi, check [URL="http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_26161921.html"]here[/URL].

Member Avatar for Mitja Bonca
0
5K
Member Avatar for techlawsam

Hi, this is called a floating-point number. check [URL="http://msdn.microsoft.com/en-us/library/586y06yf.aspx"]here[/URL].

Member Avatar for Mitja Bonca
0
132
Member Avatar for r4rozen

You would like to know whats about this code you pasted in here? There is actually missing some part - the [I]StandardDie[/I] class, but its not so important (mabye for you to understand it is). Ok, - 1st you declare 5 new variables of a custom class StandardDie. - and …

Member Avatar for pseudorandom21
0
244
Member Avatar for Jazerix

DO: [CODE] SqlConnection sqlConn = new SqlConnection("connString"); SqlDataAdapter da = new SqlDataAdapter(@"SELECT * FROM members WHERE name = @param1", sqlConn); DataTable table = new DataTable(); da.Fill(table); da.Dispose(); sqlConn.Dispose(); datagridview1.DataSource = DataTable.DefaultView; [/CODE] thats it. You will have your data in DataGridView AND Binded. So all changes in datagridview will reflect …

Member Avatar for mikev2
0
111
Member Avatar for johnt68

Sure you can - if its in any help to use 0.0 (maybe for some comparison), but better like this: [CODE] private void yourMethod() { float = inputMethod(textBox1.Text); if(floaf == 0.0) { MessageBox.Show("Please enter a number in the account number section "); } } public float inputMethod() { float temp; …

Member Avatar for arunkumars
0
2K

The End.