1,469 Posted Topics
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: try this: [CODE] Dim exampe As String = "this is text." Dim bigLetter As String = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(exampe) [/CODE] | |
Re: You could you delegates and event. This is the simpliest way to do it. You need any help? | |
Re: 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 … | |
Re: 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? | |
Re: 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); … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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)! } } } … | |
Re: 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 … | |
Re: 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++) { … | |
Re: 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 … | |
Re: 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] | |
Re: [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, … | |
Re: 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. | |
Re: [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] | |
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: 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. | |
Re: [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? | |
Re: 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] | |
Re: 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 … | |
Re: 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(); … | |
Re: 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; } … | |
Re: Try this: [CODE]Console.WriteLine("The tax rate will be: {0}.", TAX_RATE) ; [/CODE] | |
Re: 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] | |
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: 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"; … | |
Re: 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 … | |
Re: 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 = … | |
Re: 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 { … | |
Re: the problem is in while(true) loop. It seems it takes to infinity (it does not end, becuase you never call false). | |
Re: Try to remove "Value" from the if statement: [CODE] If dc IsNot Nothing Then strExport += dc.Value.ToString() & " " End If[/CODE] | |
Re: 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 … | |
Re: What you you select all (one by one, but all eventually)? Isnt this a bid odd? Or did you mean something else? | |
![]() | Re: 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] |
Re: 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, … | |
Re: You can use "this" keyword to set the background image property. this means the form you currently are. [CODE]this.BackgroundImage = "your image";[/CODE] | |
Re: Hi, Would you mind to do a big better explanation? From this one I have no clue what do you want. Thx in advance. | |
Re: 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] … |
The End.