1,469 Posted Topics

Member Avatar for Gerhardt1

1. You have a WPF project and It already has a window. You are able to run this application. 2. Now you right click on the project and Add new Window. You name it MyNewWindow.xaml 3. You would now notice MyNewWindow.xaml and MyNewWindow.xaml.cs added to your project. (the class name …

Member Avatar for Mitja Bonca
0
224
Member Avatar for aadi_capri

Here is the code you want. It check all the possibilities. Let me know what you think: [CODE] Private labelClicked As Integer Public Sub New() InitializeComponent() Dim labels As Label() = {label1, label2, label3, label4, label5, label6, _ label7, label8} For i As Integer = 0 To labels.Length - 1 …

Member Avatar for Mitja Bonca
0
460
Member Avatar for Panathinaikos22

Timer would sulrey be a better option then using Thread.Sleep() method. As nick already explained, you have to create a new instance of a Timer (Windows.Forms.Timer class!), and in the for load event (or in constructor), subscribe to a Tick event, which will be fired (after a time declated in …

Member Avatar for Mitja Bonca
0
176
Member Avatar for ericko10kip

try this: [CODE] Dim exampe As String = "this is text." Dim bigLetter As String = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(exampe) [/CODE]

Member Avatar for ericko10kip
0
126
Member Avatar for babalipk

You could you delegates and event. This is the simpliest way to do it. You need any help?

Member Avatar for skatamatic
0
146
Member Avatar for adem87
Member Avatar for SyncMaster170

You have to use UPDATE sql statement, not INSERT!! like: "UPDATE MyTableName SET @field2, @field3, @filed4 WHERE FieldName1 = @filed1" Behind the SET keyword specify the field names (columns) you want to update. No need all, just those you want to update. And you must use a WHERE clause, so …

Member Avatar for Mitja Bonca
0
137
Member Avatar for lianpiau

You are here showing only how you insert data from dgv A into a database. Do you then populate dgv B from dataBase, of from dgv A?

Member Avatar for Mitja Bonca
0
283
Member Avatar for user543820

To read a file and to get word by word (seperated one from another), then you can doit this way: [CODE] List<string> list = new List<T>(); using(StreamReader sr = new StreamReader("filePath")) { string line; while((line = sr.ReadLine()) != null) { string[] words 0 line.Split(' '); foreach(string word in words) list.Add(word); …

Member Avatar for user543820
0
4K
Member Avatar for RenanLazarotto

Hi, Im doing some code for you. I have salved the 1st point (I am using "FolderBrowserDialog" object - which is only meant to choose a folder, so no files showed; thisis best for you since you want to get only spcific files. Lets go to 2. point: Why would …

Member Avatar for RenanLazarotto
0
215
Member Avatar for rockout15

I guess soem of your converting to integer from stirng throuwn an exception. Please double check if your textBoxes which MUST have integers only, do really have them. My guess is that is one of them textboxes there is not only a number inside (a number without any decimal places …

Member Avatar for Mitja Bonca
0
345
Member Avatar for junharefa

Hi, tb_order.order_quantity or tb_use.use_quantity are updated, you can then create another command to update item_stock, like: [CODE] SqlConnection sqlConn = new SqlConnection("connString"); SqlCommand cmd = new SqlComand(); cmd.ComamndText = @"UPDATE tb_order SET order_quantity = @quantity WHERE (create a condition here"; //no parentheses! cmd.Connection = sqlConn; sqlConn.Open(); cmd.ExecuteNonQuery() //do 1st update …

Member Avatar for junharefa
0
380
Member Avatar for AirWave

Substring is a method that has two parametes: 1. Starting index 2. Numbers of characters So when you call Substring(1, 1) -> that means you are taking 2nd character only (starting index is 1, and you take 1 character). And because you are parsing to integer - it MUST be …

Member Avatar for kplcjl
0
171
Member Avatar for johnt68

Tell us your problem, and paste the (necessary) code!! (not all of it :) ) that there is an issue in here. And we`ll try to help you out.

Member Avatar for johnt68
0
283
Member Avatar for Srcee

Check this example code, it works well: [CODE] System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add("emails to send to(multiple are seperated by comma"); message.Subject = "subject"; message.From = new System.Net.Mail.MailAddress("Mail From -you email"); message.Body = "body text" System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.Credentials …

Member Avatar for Srcee
0
138
Member Avatar for sha2

Try this code I am using: [CODE] static class Program { [STAThread] static void Main() { using (Login login = new Login()) { login.StartPosition = FormStartPosition.CenterScreen; if (login.ShowDialog() == DialogResult.OK) { Application.Run(new Form1(login.strUserName)); //passing the userName to the constructor of form1 (from Login form - global variable)! } } } …

Member Avatar for ddanbe
0
295
Member Avatar for chathuD

What do you mean to get the difference between two dates in the integer type? the number in minutes, seconds, hours, or something else? To get the difference you have to use TimeSpan class, which has all the time values (seconds, minutes, hours, milliseconds,..). You can do it: [CODE] DateTime …

Member Avatar for Mitja Bonca
0
333
Member Avatar for Zvjezdan23

So you would like to learn multidimensional arrays? Try to use for loops with them: [CODE] int[,] myInts = new int[2,3] { 1, 2, 3 }, { 4, 5, 6 } }; for(int i = 0; i < myInts.GetLenght(1); i++) { for(int j = 0; j < myInts.GetLenght(0); j++) { …

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

Put Listener.Start() method, just under where you create a reference of TcpListener, so like: [CODE] private void initiateListen() { //Tcp this.tcpListener = new TcpListener(IPAddress.Any, portnumber); tcpListener.Start(); //HERE!! //why you have this code bellow?? //you need a new variable to get Port no: int intPort = Convert.ToInt32(portnotxt.Text.Trim()); this.threadTcp = new Thread(new …

Member Avatar for Mitja Bonca
0
2K
Member Avatar for complete

As Memorath said, DateTime cannot be changed. But you can parse it to string, and change the string to your own "datetime" format (but remember, this is not going to be a real DateTime value anylonger). try this: [CODE]DateTime date = DateTime.Now.Date; string strDate = date.ToString("yyyy-MM-dd 00:00:00");[/CODE]

Member Avatar for Mitja Bonca
0
239
Member Avatar for Shizuo

[QUOTE=Shizuo;1651387]how do I code the query for getting data from table where datadate = valueofdatepicker or < 15 days something like SELECT * FROM EMPLOYEE WHERE Hireddate BETWEEN ( @date and @date-15days) <---how do I subtract the 15 days?[/QUOTE] If you mean to get some data based on two conditions, …

Member Avatar for Mitja Bonca
0
103
Member Avatar for SyncMaster170

Do you use any DataSource? You better be using it - like DataTable. And when you will do changes in datagridview, all changes will reflct in dataTable as well.

Member Avatar for SyncMaster170
0
521
Member Avatar for SyncMaster170

[CODE] private void insertDate() { da.UpdateCommand = new SqlCommand("UPDATE WaynokaLogger SET Date = @Date", cs); da.UpdateCommand.Parameters.Add("@Date", SqlDbType.Date).Value = dt; da.UpdateCommand.ExecuteNonQuery(); [/CODE]

Member Avatar for Mitja Bonca
0
526
Member Avatar for fernandofranca

You cannot add rows to dataColumn. You can ONLY add then to dataTable. DataColumn is only a "part" of dataTable, as it is Datarow. So what i suggest you, is that you add new column to dataTable, and then add data to this column (you do NOT need to add …

Member Avatar for fernandofranca
0
282
Member Avatar for Shizuo

This way: [CODE] " WHERE Emp_ID= '",rec.Emp_ID, "'"), clsData.con); [/CODE] One more thing, you can write pluses "+" instead of commas ",", like: [CODE] " WHERE Emp_ID= '" + rec.Emp_ID + "'"), clsData.con); [/CODE]

Member Avatar for Mitja Bonca
0
100
Member Avatar for Shizuo

Change this line of code (sql query) into: [CODE] OleDbCommand cmd = new OleDbCommand(Stirng.Format("INSERT INTO CHILDREN2 (Emp_ID , Child_Name, Age) VALUES ({0}, {1}, {2})", Convert.ToInt32(CaptionText.Text),txtName.Text, txtAge), clsData.con); [/CODE] Do you have a WHERE clause too? I removed it from your query, becasue it didnt belonge on that place where you …

Member Avatar for arunkumars
0
92
Member Avatar for Khyati Patel

You didnt tell what will be the validation like? I mean, what will you validate?! For TextBoxes, you can do (if you have them that many) some additional method for validating textBoxes one by one.

Member Avatar for Mitja Bonca
0
97
Member Avatar for user543820

[QUOTE=sajid1;1648307]Hi! I want to create my own list of keywords so that if I write spells of any keyword wrong, it get's underlined like in usual compilers. How can I create a list and create an underline command?[/QUOTE] Will you use RichTextBox control?

Member Avatar for Mitja Bonca
0
88
Member Avatar for Asotop

There is many methods to do the checking, one (and most common) is to use TryParse method: [CODE] int myNumber = 0; if(int.TryParse(textBox1.Text, out myNumber)) { //this is a number, } else { MessageBox.Show("Sorry, string is not a number."); textBox1.Text = string.Empty; } [/CODE]

Member Avatar for skatamatic
0
140
Member Avatar for TIP.Synergy

An [URL="http://objectlistview.sourceforge.net/cs/index.html"]ObjectListView[/URL] will do exactly that and much more. It is a wrapper around a normal .NET ListView. It is open source. Its website has a G[URL="http://objectlistview.sourceforge.net/cs/gettingStarted.html"]etting Started[/URL] to help you begin, as well as a whole page devoted to [URL="http://objectlistview.sourceforge.net/cs/cellEditing.html"]cell editing[/URL]. Otherwise I would stringly suggest you to use …

Member Avatar for TIP.Synergy
0
124
Member Avatar for BoBok2002

Try this: [CODE] public static Bitmap BitmapFromWeb(string URL) { try { // create a web request to the url of the image HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL); // set the method to GET to get the image myRequest.Method = "GET"; // get the response from the webpage HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); …

Member Avatar for BoBok2002
0
576
Member Avatar for caseyl89

Check this code: [CODE] Excel.Application xlApp ; Excel.Workbook xlWorkBook ; Excel.Worksheet xlWorkSheet ; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); //get columns: for (int i = 0; i <= this.dataGridView1.ColumnCount - 1; i++) { string colName = dataGridView1.Columns[i].HeaderText; xlWorkSheet.Cells[1, i] = colName; } …

Member Avatar for caseyl89
0
701
Member Avatar for techlawsam
Member Avatar for techlawsam
0
87
Member Avatar for techlawsam

Numbers in brackets are placeholders (starting from 0 on). Values that you pass are showing instead of number and bracket together. Example: [CODE] ("{0}", myValue)[/CODE] We can say its a stirng format, which you can use in the same form in Win forms: [CODE]MessageBox.Show(String.Format("{0}", myValue));[/CODE]

Member Avatar for Mitja Bonca
0
10K
Member Avatar for Lek Plepi

Try this code to create a moving button from one location to another: [CODE] Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Namespace WindowsApplication9 Public Partial Class Form1 Inherits Form Public Velocity As Integer() = New Integer(1) {} Public count As Integer Public Dest As System.Drawing.Point …

Member Avatar for Techyon
0
357
Member Avatar for berwick53

Then do: [CODE] string[] LinesFile = streamReader.ReadToEnd().Split('\n'); for(int i = 0; i < LinesFile.Lenght; i++) { for(int j = 0; j < LinesFile[i].Lenght; j++) { string[] LinesData = string.Split(','); foreach(string item in LinesData) { Console.WriteLine(item); } } } Console.ReadLine(); [/CODE]

Member Avatar for manugm_1987
0
143
Member Avatar for Esofts

Try using SqlDataAdapter for this job. Or you can even try using SqlComamndBuilder (of OleDb for Access database instead of Sql): [CODE] SqlDataAdapter adapter; DataSet dataset; private void Form1_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(Properties.Settings.Default.Database1ConnectionString);//Set the connection to the SQL server adapter = new SqlDataAdapter("select * from …

Member Avatar for Esofts
0
496
Member Avatar for eleoc

Radion button has two states. So you cannot have three option, and not if else statements (using ? : marks). Only two. So you can have: [CODE] string output; output = "[" + this.textBoxUID.Text + "]" ; output += this.textBoxCompany.Text; output += this.textBoxDate.Text; output += this.radioButtonby.Checked ? "Low" : "High"; …

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

If I get your correctly, you populate DGV with some values: name, surname, and another surname - all in one cell. Now you would like to split this cell into name, and lastnames? If Iam correct, Split it by whitespace: [CODE] Dim data As String() = dataGridView1.Rows(0).Cells(0).Value.ToString().Split(" "C) 'data array …

Member Avatar for Zeth643
0
887
Member Avatar for fashxfreak

And try to use Parameters, so you dont assign values directly into the query, but in query you only write parameters, which you then add bellow. Example: [CODE] OleDbCommand com = new OleDbCommand(@"UPDATE cus SET cus_name = @param1, order = @param2 WHERE no = @param3", con); com.Parameters.Add("@param1", OleDbType.VarChar, 50).Value = …

Member Avatar for Mitja Bonca
0
199
Member Avatar for Alokkumar11

So, what do you wanna know? A field declared with the static modifier is called a static variable. Static variables - if they are marked as public they are accessed without a class reference. For intance: [CODE] class class1 { public static string myVar = "abc"; } class class2 { …

Member Avatar for skatamatic
-2
185
Member Avatar for c1ockwerk

the problem is in while(true) loop. It seems it takes to infinity (it does not end, becuase you never call false).

Member Avatar for skatamatic
0
159
Member Avatar for Alexkid

Try to remove "Value" from the if statement: [CODE] If dc IsNot Nothing Then strExport += dc.Value.ToString() & " " End If[/CODE]

Member Avatar for Surendrasinh
0
997
Member Avatar for shandoosheri

Are these files in one folder? If so, you can get all files from this folder into a FileInfo[] (you need fileInfo, because you need a full path, so set files back where they were before renaiming). Then you do some additional code of renaiming and use Move method for …

Member Avatar for shandoosheri
0
308
Member Avatar for yousafc#

What you you select all (one by one, but all eventually)? Isnt this a bid odd? Or did you mean something else?

Member Avatar for yousafc#
0
123
Member Avatar for Jack1312

You didnt specify where exactly this error occurs, but i assume inthe for loop. Try to change it to: [CODE] if (!line.StartsWith("!") && line != "" && !line.StartsWith("#")) { //your code... } [/CODE]

Member Avatar for nick.crane
0
250
Member Avatar for RvSon

Getting data (all of it): 1. Create a DataTable (to later get the data out of dataBase) 2. Connect to the dataBase with an appropriate connection string (using Connection class) 3. Fill dataTable, using DataAdapter class ------------ Showing data (one by one question): 4. Loop through the rows of dataTable, …

Member Avatar for Singlem
0
164
Member Avatar for yousafc#

You can use "this" keyword to set the background image property. this means the form you currently are. [CODE]this.BackgroundImage = "your image";[/CODE]

Member Avatar for nick.crane
0
315
Member Avatar for westony

Hi, Would you mind to do a big better explanation? From this one I have no clue what do you want. Thx in advance.

Member Avatar for nick.crane
-1
143
Member Avatar for lianpiau

The question is, do you really need a dataSet? Do you have more then one DataTable? Becuause DataSet is nothing else then a bunch of dataTables. Some strange code you have there: [CODE] sAdapter.Fill(sDs, "OT"); //OT is the DataTable name right? sTable = sDs.Tables["OT"]; [/CODE] better try this was: [CODE] …

Member Avatar for Momerath
0
643

The End.