1,469 Posted Topics
Re: And how do you want to choose different conditions? I really dont understand your question. Please elaborate this issue of yours a bit better. Do you write any text into textBox, and thats why you use LIKE condition? If so, you have to change the code to: [CODE] string _value … | |
Re: Change to: [CODE] private void listviewTCourse_SelectedIndexChanged(object sender, EventArgs e) { MyDataAdapter = new SqlDataAdapter("select distinct(s.Semester_No) from tblSession s,tblCourses c where s.C_Code = c.C_Code and c.C_Name = '" + listviewTCourse.SelectedItem.ToString() + "'", MyConnection); MyDataSet = new DataSet(); MyDataAdapter.Fill(MyDataSet); foreach(DataRow dr in MyDataSet.Tables[0].Rows) { listViewSem.Items.Add(dr[0].Tostring()); } [/CODE] | |
Re: I didnt get your question either. Would you please explain your issue a bit n details? thx in advance. | |
Re: Are your column names in all dataBases the same? If they are, you can use dataBinding. Otherwise you will have to populate DGV manually. How? 1st you need to have the same number of columns or less (NOT more)! Then simply loop through each dataTable (each will be filled from … | |
Re: Answer 1: use text file (you dont need any dataBase). Do some logical hierarchal sequence of values in this file, so you can easy retrieve them back out (just something simple) Answer 2: I dont actually know the game, so hard to tell. If you know it, you can have … | |
Re: I dount this is how you can set some property over forms. Even if you will set the property to false, but button will not be dissapear at that moment (it will be visible until that form will get focus). So I suggest you some other way. To Call a … | |
Re: This is another solution: [CODE]string yourWord = text.SubString(text.LastIndexOf(" "), text.Lenght - text.LastIndexOf(" "));[/CODE] | |
Re: Are you talking about connection string? If so you can insert values of the textBoxes into conn.string like this: [CODE] string = @"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=" + textBoxUsername.Text + ";Password=" + textBoxPassword.Text + ";"; [/CODE] | |
Re: Momerath, I can see you are pretty familiar with Regex. But Iam not. I would like to learn then more. So I will ask right here. How to do (seperate) the regex, that will check for more conditions? Is the seperator the backslash ''? Or how would be the easiest … | |
Re: You have to reverse the words, you can use a method to do it so: [CODE] public string Reverse(string str) { int len = str.Length; char[] arr = new char[len]; for (int i = 0; i < len; i++) { arr[i] = str[len - 1 - i]; } return new … | |
Re: [CODE] sp.Value = !String.IsNullOrEmpty(t.HasValue) ? (object)t.Value : DBNull.Value; [/CODE] | |
Re: This example requires that the code in the example is called from a form that has its IsMdiContainer property set to true. That means that your MainForm has the property IsMdiContainer set to true; [CODE] //before creating a new instance of a Report class, do: this.IsMdiContainer = true; Report newMDIChile … | |
Re: Impossible. You cannot have two different colors in textBox control. To have multiple rows and beside multiple colors, you can use listBox for instance. Take a look at [URL="http://www.dotnetspider.com/resources/29277-c-NET-Multi-Colour-Listbox-items.aspx"]here[/URL] for an instance. | |
Re: textBox is by default set to OneRow Text only. That means that the control does NOT have multiple rows. If you want to show values in the textBox in rows, you hav to turn on "MultiLine" property (you have to set it to true), and its even good to define … | |
Re: Instead of using NewLine property all the time, you can think of using StringBuiler, and append lines going through the loop of those words: [CODE] string[] array = {"this", "will","make"}; //and so on (put all the words into an array - or generic list<T>) //then: StringBuilder sb = new StringBuilder(); … | |
Re: What you have to do, is to pass a class variable reference of Form1 to Form2. And then use this variable to show form1 again, like this: [CODE] //on form1: Form2 f2; //on method to show Form2: if(f2 == null) f2 = new Form2(this); f2.Show(); this.Hide(); //DO NOT close Form1 … | |
Re: That means that this file is opened. An because it is opened, it means that it is used by another process. You will have to close it down, and then you can do (execute) your code. Check doube times if file is in use or not (but I am sure … | |
Re: Hmmm... this is not an easy answer. It would be better to get your self a book about basics of programming, because question of yours is exactly this. It will take some time to understand what are you asking, and some more to make it work (in complete). We cannot … | |
Re: Take a look at this example, how you access to some other namespace: [CODE] namespace Maj16Test1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); NewNameSpace.NewClass class1 = new NewNameSpace.NewClass(); class1.NewMethod(); } } } namespace NewNameSpace { public class NewClass { public NewClass() { MessageBox.Show("Message in the … | |
Re: How to disable? You cannot disable them. You can only go through SelectedIndexChanged event of the dropDownList, and get selected index. And if index is between 120 and 150, do not use this item. | |
Re: Exacttly. Text property is a String type. So you cannot use operatoros like <, > on them. YOu can only use these kind of operators on numbers (int, decimal, double, float,.. types). [CODE] Dim a As Double = Double.Parse(displayText.Text) Dim b As Double = Double.Parse(TextBox2.Text) If a > b Then … | |
Re: If you got it, just mark this thread as answered. Thx in advance. | |
Re: Take a look at here on this example: [CODE] DataSet ds; SqlDataAdapter adap; private void LoadData() { if(ds != null) ds.Clear(); adap = new SqlDataAdapter("select id,title, description from testtable", con); ds = new DataSet(); adap.Fill(ds); dataGrid1.DataSource = ds.Tables[0]; } //This click will update one of the field in the database … | |
Re: You have 3 loops here. It seems strange to me. 1st you loop through rows, and in eqach row you loop through columns, and in each column you loop again through rows od dataTable. This has no point I would say. Tell me one thing, what dataSet (dataTable at index … | |
Re: Try this: [CODE] System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(strEmailStranke); message.Subject = "subject"; message.From = new System.Net.Mail.MailAddress(strObvEmail); 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 = new System.Net.NetworkCredential("userName, "password"); //of gmail access smtp.Send(message); [/CODE] it works for me. | |
Re: CSV File seperates a row data by comma (,).So you have to use a StreamReader, and split the row (line) by comma. these seperated data are for columns. | |
Re: You cn do it this way: [CODE] if(cboemployee.SelectedItem.ToString().Equals("All fields")) { //if it does, your code in here } [/CODE] or this way: [CODE] if(cboemployee.SelectedItem.ToString() == "All fields") { //if it does, your code in here } [/CODE] | |
Re: Yu have to put creation of the new instance of a Random class on the class level then it will do. So you have to do it, like: [CODE] Form1 { Random generator = new Random(); public Form1() { //form1`s constructor InitializeComponent(); } public double RandomNumber() { //declares random number … | |
![]() | Re: Try this code. It will enable button as soon as all buttons will have some text inside. [CODE] public Form1() { InitializeComponent(); button1.Enabled = false; TextBox[] tbs = { textBox1, textBox2, textBox3 }; //put all the textBoxes you want in here foreach (TextBox tb in tbs) tb.TextChanged += new EventHandler(tb_TextChanged); … ![]() |
Re: You put one under another. Two tabControls one under another. Just the Y axis is for the 2nd one a bit lower. So lets say the coordinate (location) for both tabControls: [CODE] tabControl1.Location = new Point(20, 20); tabControl2.Location = new Point(20, 45); //this will be lower (under tabControl1)[/CODE] | |
Re: Disable all the controls (set the property of each control "Enabled" to false). Then when user inserts his userName and password validate the data, if all coorect, enable all the controls. | |
Re: [CODE] //sql query string query = "SELECT * FROM MyTable"; //create connection SqlConnection sqlConn = new SqlConnection("connString"); //create command SqlCommand cmd = new SqlCommand(query, sqlConn); //create dataAdapter SqlDataAdapter da = new SqlDataAdapter(cmd); //Create DataTable: DataTable table = new DataTable("MyTable"); //fill table: da.Fill(table); //to show in your application there is many … | |
Re: This might help: [CODE] dataGridView1.Rows[0].Cells[0].Selected = false; [/CODE] | |
Re: Yep just to add to ddanbe post (how to practicaly do it): [CODE] string a = "10:12"; a = a.Replace(":", ".");[/CODE] | |
Re: You forgot to define a value in the String format: [CODE] Dim intValue As Integer = 12345 Dim strValue As String = [String].Format("{0:000000}", intValue) 'output is : 012345 [/CODE] | |
Re: Try using DataSource property to bind the data with the contorol: [CODE] Dim listofdays As New List(Of String)() 'populate the list 'then bind comboBox with the generic list<T>: comboBox1.DataSource = listofdays [/CODE] | |
Re: Hi, i did the code for you, I hope I have understood you well. Check it out, and let me know: [CODE] Public Partial Class Form1 Inherits Form Private bList As BindingList(Of Game) Private list As List(Of ListCheck) Public Sub New() InitializeComponent() dataGridView1.CurrentCellDirtyStateChanged += New EventHandler(AddressOf dataGridView1_CurrentCellDirtyStateChanged) dataGridView1.CellValueChanged += New … | |
Re: According to MSDN : Setting the BackColor has no effect on the appearance of the DateTimePicker. You need to write a custom control that extends DateTimePicker. Override the BackColor property and the WndProc method. Whenever you change the BackColor, don't forget to call the myDTPicker.Invalidate() method. This will force the … | |
Re: You want to convert some value to double, which apparently is NOT a double. So to get rid if try, catch blocks and some strnage errors, you can use TryParse method in this manner: [CODE] double answer; if (sender is System.Windows.Forms.Button) { if (double.TryParse(answerBox.Text, out answer)) answer = Convert.ToDouble(answerBox.Text); else … | |
Re: Do you know that this line of code: [CODE] string strSource = webClient.DownloadString(URL);[/CODE] will get the whole code of the website. So its almost impossible to compare this text with some other. You will have to get some text out of that string. | |
Re: Use Linq: [CODE] string[] a = { "a", "b", "c" }; string[] b = { "b", "c", "d" }; string[] c = a.Intersect(b).ToArray(); [/CODE] Array c has values "b" and "c". | |
Re: The easiest way would be to get all and then count top 6 from the dataTable. [CODE] //create connection, command (cmd) DataTable table = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(table); //select top 6: //you can even sort datra if you want!! for(int i = 0; i < table.Rows.Count; … | |
Re: use Enable property (not ReadOnly): [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox1.Enabled = false; textBox1.Text = "Some text"; } private void button1_Click(object sender, EventArgs e) { textBox1.Enabled = true; textBox1.Focus(); textBox1.SelectionStart = 0; textBox1.SelectionLength = 0; } } [/CODE] | |
Re: I would even suggest you to create you own report (recommend Crystal Reports) and pass data (checked rows) to the report and show then here. | |
Re: Why do you want to use Lock? To prevent user can resize form? If so, you use form`s properties like: MaximizeBox, MinimizeBox, like: [CODE] //on form1: Form2 form2 =new Forms(); form2.MaximizeBox = false; form2.MinimizeBox = false;[/CODE] Or is there anything else you want to use Lock? | |
Re: Try this code: [CODE] public static bool isValidEmail(string inputEmail) { string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" + @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"; Regex re = new Regex(strRegex); if (re.IsMatch(inputEmail)) return (true); else return (false); } [/CODE] | |
Re: One thing, I would strongly suggest you to use only one column for the record number. You have to combine Loading number and Record number. This way you will have a lot less problems. It sure is possible to create a working code for this kind of dataBase structure you … | |
Re: Hi, if you have dgv bound to dataTable you can only loop through the dataTable, and retreive all the data from dataTable (no need from dgv), because all the data put into dgv, are "automatically" saved into dataTable as well (because of the binding source). 1st loop has to go … | |
Re: [CODE] static void Main(string[] args) { Program d = new Program(); d.Myprog("ahasda"); Console.ReadLine(); } void Myprog(params string[] array) { int num = 0; foreach (string str in array) { foreach (char c in str) { if (c.Equals('a')) num++; } } Console.WriteLine(num); } [/CODE] | |
Re: What dont you put all the data into DataTable, and then only use SqlCommandBuilder object to do an Update of the data in DataTable to the Appropriate Table in DataBase? Here are links how to do it: [url]http://support.microsoft.com/kb/308507[/url] and [url]http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.updatecommand%28v=vs.71%29.aspx[/url] |
The End.