1,469 Posted Topics
Re: DO NOT use the form load event for populating control (on form2), becuase it will rise only 1 time (only when form opened). Better create a new method on form2, and call it each time you want to pass some data from form1 to form2. This way you can execute … | |
Re: Impossible. If you want to disable a control, you have to use "Enabled" property of a control. And it must be set to false. Or you can even use "ReadOnly" property, which has to be set to true (to be disabled). | |
Re: I would open file from double clicking on the item in comboBox, rather then with a button click (which is an additional - unnecessary task to do - if we are picky). So to open more files, you can use Shitch statement, and specify what ever you need in each … | |
Re: at the buttom of the page there is a button " mark as asnwered" or something. | |
Re: Check [URL="http://msdn.microsoft.com/en-us/library/53ezey2s(v=vs.90).aspx"]here[/URL] more about Process.Start, method (when overloads stirng parameter). | |
Re: [QUOTE=brightline;1778418]Dear All, I had developed a desktop application that searches word files contents in a folder for a specific word(s) .It's working fine, but it's slow. I want to apply indexing(or any other technique) to speed up the performance of my application ... I want to know how to apply … | |
Re: I cannot see the image, and since you didnt write anything about the issue, we cannot help you out yet. So please... But regarding your thread`s title, I can see you are trying to access to some control`s property, which you cannot directly. Why not? Because control is created on … | |
Re: Yep, I would only recommend you to use parametriezed query, so you specify the parameter in additional like of code: [CODE] cmd.CommandText = "Delete From bookings where Bk_id = @param1" cmd.Parameters.Add("@param1", SqlDbType.Int).Value = Integer.Parse(dataGridView1(0, dataGridView1.CurrentRow.Index).Value.ToString()) [/CODE] | |
Re: TextChnaged event will not fire while pressing Enter key (carriage return). To get this key pressed, you have to consider of using any of KeyPress events, like: KeyDown: [CODE] c [/CODE] or here is another option: [CODE] private void ByteData_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { // … | |
Re: [QUOTE=preeti anand;1782780]How to convert automatically system genrated string to int in c# code.[/QUOTE] Im not sure what do you mean? If you have a number, you can do in many ways: [CODE] string yourString ="...."; //some value, you said its a number int myInt = 0; if(int.TryParse(yourString, out myInt) { … | |
Re: 1. Do not create controls public - keep them private. 2. Use form1`s reference on form2, so you can access memebers of form1 from form2. Then simply use this reference on form2 to get the value (you want to) from form1. | |
Re: You have to add a reference of the project you want to access to (right click on References in solution explorer, then select Add Reference, then select Browse tab and look for appropriate file in the project you want to access). Then Add this reference on the top on the … | |
Re: or this: [CODE] string dirPatgh = @"C:\MyFolder\"; DirectoryInfo di = new DirectoryInfo(dirPath); // Get a reference to each file in that directory. FileInfo[] files = di.GetFiles(); foreach(FileInfo file in files) { listbox1.Items.Add(file.Name); } [/CODE] | |
Re: Use parametreized query: [CODE] Dim query As String = "UPDATE cg_security_user_right SET user_id, right_id ,enable_flag WHERE LastName = @param1 AND right_id = @param2 AND enable_flag = @param3" Dim conn As New SqlConnection("connString") Dim cmd As SqlComamnd = New SqlCommand(query, conn) cmd.Parameters.Add("@param1", SqlDbType.VarChar, 50).Value = tuser.Text cmd.Parameters.Add("@param2", SqlDbType.Int).Value = Integer.Parse(tright.Text) 'check … | |
Re: Would you mind showing us your code, the one you think it might cause problems? [URL="http://blogs.msdn.com/b/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx"]Here[/URL] is some good article about this problem, read it, it might give you an idea. | |
Re: Maybe something like this: [CODE] static int Find(int el, int[] a) { int index = -1; for (int i = 0; i < a.Length; i++) { if (a[i] == el) { return a[i]; } } return index; } [/CODE] | |
Re: When you instanitate new variables, specify their beggining values, like: [CODE] //instead of: double rate, year, presentValue, futureValue; //do: double rate = 0, year = 0, presentValue = 0, futureValue = 0; [/CODE] | |
Re: If you are using Sql class do as: [CODE] SqlConnection conn = new SqlConnection("connString"); String query = "SELECT SUM(pf5_showplaylists.runningtime) FROM pf5_showplaylists WHERE pf5_showplaylists.showID = @param1"; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.Add("@param1", SqlDbType.Int).Value ShowID; //MUST BE AN INTEGER!! If not do: //cmd.Parameters.Add("@param1", SqlDbType.VarChar, 50).Value ShowID; int mySum = Convert.ToInt32(cmd.ExecuteScalar()); //dispose … | |
Re: [QUOTE=poolet25;1775246]HI just need a way to reset the DataAdapter1 into 0 (like reset) [/QUOTE] Set datasource to null. This way you reser it. | |
Re: have you heard of multidimensional arrays? This is the answer here. btw, how do we get those results (any formulas)? | |
Re: This is all the code you need: [CODE] //on form1: int counter; Form2 f2; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (counter < 5) { f2 = new Form2(); counter++; f2.Show(); } else MessageBox.Show("Form2 cannot be opened any longer."); } [/CODE] | |
Re: come on stop making duplicate threads. One will do it. | |
Re: If you wanna see the image put some images (those you need9 into project - into the Resources). Then you can create a switch statement, and based on an integer you will show appropriate image. Or simply create an image from some file on the disc (by specifing the path … | |
Re: Its not a bad idea to create (your own website, or some page of it) to point the help from your app. to it, like: [CODE] Help.ShowHelp(this, "http://www.helpware.net"); //this is exmaple url [/CODE] | |
Re: This is a simple code, that creates an array of 4 integers, and addes a random number to each index. [CODE] Dim r As New Random() Dim nums As Integer() = New Integer(3) {0, 0, 0, 0} For i As Integer = 0 To 3 If nums.Sum() <= 100 Then … | |
Re: Hi, 1st of all, you have to create an array of all buttons, accessible inside a class (or form). Then use access to them with only one event: [CODE] Public Partial Class Form1 Inherits Form 'I have put 3 buttons on my form!! Private buttons As Button() Public Sub New() … | |
Re: Use parametrized query, and define in the parameter which value to choose, like (example code): [CODE] Dim query As String = "INSERT INTO MyTable VALUES (value1 = @param1, value2 = @param1)" 'value 1 is exmaple id column 'value 2 is the male of female. Dim conn As New SqlConnection("connString") Dim … | |
Re: This is a "bad" way of programming. Do as Momerath told you to. so: [CODE] string sql = "UPDATE Orders SET Status= ? WHERE OrderID = ?"; OleDbCommand cmd = new OleDbCommand(sql, connDBString); cmd.Parameters.AddWithValue("@id", "1"); //NOTE: is OrderID type of varchar? if its integer, pass an integer, not a string! … | |
Re: hi, into this class (or form) you pass a role value (what ever string or integer type), and based on that you can then use if/else if statements or swith, like you already showed us in your code. Do it as: [CODE] //on form1: //pass a role variable to form1, … | |
Re: With Microsoft Sql Server: -- -- Create test case -- DECLARE @myDateTime DATETIME SET @myDateTime = '2008-05-03' -- -- Convert string -- SELECT LEFT(CONVERT(VARCHAR, @myDateTime, 120), 10) | |
Re: The point is in accessing a database. There is all stored (usernames, passowords,...). So you need a connection string to the particulat databse (sql, mysql, oracle, ...) and then you have to know table names and columns inside of each. Then you can with some knowledge of sql query statements … | |
Re: I would suggest you to make method static. The problem is that all the content of them stays in the memory until you close the application. So use static only if really needed (or for some small methods). About your question, it would be good to share the code with … | |
Re: Do you use Crystal Reports? You can do that, simply create parameters in your report, and pass values from textboxers to these parameters. | |
Re: Do you already have emails of users? If you have an account on gmail, you can simply use it, to send emails to others. What you need, is to create a list of users (with their emails is enough), and then do a loop through them and on each loop … | |
Re: Where come these data of yours that populates gridview? Is gridview databound? Tell us more, so we can help you more. | |
Re: Try this way: [CODE] public partial class Form1 : Form { static List<string> urls; static Random random = new Random(); public Form1() { InitializeComponent(); if(urls == null) { urls = GetWebsiteUrls(); //Need to implement } string url = urls[random.Next(urls.count)]; System.Diagnostics.Process.Start("iexplore.exe", url); //try using some other webbrowser too } } [/CODE] | |
Re: Try using: [CODE] Dim conn As New SqlConnection("connString") Dim query As String = "SELECT * FROM products" Dim cmd As New SqlCommand(query, conn) Dim da As SqlDataAdapter = New SqlDataAdaper(cmd) Dim table As New DataTable("myTable") da.Fill(table) 'dispose all IDisposable objects... [/CODE] | |
Re: There is a better option: Allow users to enter a full telephone number, without brackets and dashes. The number like 6303452532 - all together. If the number have to be a type of long. Then you do the checking if the value is really a long. If its not user … | |
Re: Tital i double type, so convert the value from dataRow to double (use Convert ot parse method). | |
Re: This problem occurs because the MySQL ODBC driver reports catalog and table names for the table, but reports an empty string for the schema. Visual Studio is expecting a schema here, and is formulating the 3-part name that you see, in the format "catalog.schema.table". Since there is no schema, you … | |
Re: You have to use StringBuilder class to write into it 1st, then when you are done with reading files, you do the Write thing. So your code shoud look (in sepearate methods): [CODE] class Program { static void Main(string[] args) { string readFrom = @"F:\abc\"; string writeTo = @"F:\test.txt"; StringBuilder … | |
| |
Re: Exactly on which line the error occurs? | |
Re: Ok, I took an hour only for your, to do the code insread of you. It works like you wanted, so like charm :) Take a look, and let me know: [CODE] Public Sub New() Dim table1 As New DataTable("t1") Dim table2 As New DataTable("t2") table1.Columns.AddRange(New DataColumn() {New DataColumn("ID", GetType(Integer)), … | |
Re: Make it simple: [CODE] Random rand = new Random(); int[] vett = new int[16]; for (int i = 0; i < vett.Length; i++) { vett[i] = rand.Next(1, vett.Length + 1); Console.WriteLine(vett[i]); } [/CODE] | |
![]() | Re: [B]You are a BAD reader mate.[/B] If you would read my post in some other tread of yours, you would see I told you you can NOT do mathematical opearations over stirngs. Text property or textbox, SelectedItem of listBox, are type of string, and thats why you cannot do math … |
Re: Put some boolean flag into the code, so you can say to the code when it can be used and when not - but you. I mean something like: [CODE] bool bFlag = false; void buttonEnable()//event of button { bFlag = true; // this will prevent firing the ItemChecked code … | |
![]() | Re: Remember: 1. you cannot do math operations over strings; you MUST convert them to appropriate type (I used integers, if trey are not, change them to appropriate type!! 2. messagebox shows strings, so if there is any value not-a-string, convert (or parse) it to stirng. So do: [CODE] MessageBox.Show("Basic hours … ![]() |
Re: try: [CODE]strsql = "delete from cg_security_user_right where user_id = '" & TextBox1.Text & "' role_id = '" & TextBox2.Text & "'"[/CODE] | |
Re: I dount we can help you out with this, maybe you didnt use the correct formulas for calculation. Code it self looks fine. |
The End.