1,469 Posted Topics

Member Avatar for Revathy Sesha

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 …

Member Avatar for jbennet
0
766
Member Avatar for huskarit

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).

Member Avatar for huskarit
0
243
Member Avatar for gogs85

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 …

Member Avatar for Mitja Bonca
0
357
Member Avatar for Denden17

at the buttom of the page there is a button " mark as asnwered" or something.

Member Avatar for Mitja Bonca
0
127
Member Avatar for skp03

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).

Member Avatar for Mitja Bonca
0
225
Member Avatar for brightline

[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 …

Member Avatar for skatamatic
0
107
Member Avatar for BanksyHF

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 …

Member Avatar for skatamatic
0
205
Member Avatar for dilse4sk

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]

Member Avatar for Mitja Bonca
0
171
Member Avatar for NOVICE3

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) { // …

Member Avatar for Mitja Bonca
0
2K
Member Avatar for preeti anand

[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) { …

Member Avatar for Mitja Bonca
0
122
Member Avatar for bernardz26

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.

Member Avatar for Mitja Bonca
0
110
Member Avatar for SoftwareGuy

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 …

Member Avatar for kplcjl
0
241
Member Avatar for jjsmithy

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]

Member Avatar for jjsmithy
0
111
Member Avatar for Farhan_B

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 …

Member Avatar for cyberdaemon
0
363
Member Avatar for Robert955

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.

Member Avatar for pseudorandom21
0
91
Member Avatar for diGGity

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]

Member Avatar for diGGity
0
157
Member Avatar for ipodtrip

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]

Member Avatar for Mitja Bonca
0
807
Member Avatar for cchacholiades

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 …

Member Avatar for vimit
0
4K
Member Avatar for poolet25

[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.

Member Avatar for poolet25
0
5K
Member Avatar for zhouy

have you heard of multidimensional arrays? This is the answer here. btw, how do we get those results (any formulas)?

Member Avatar for zhouy
0
1K
Member Avatar for khizer03

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]

Member Avatar for codeorder
0
127
Member Avatar for skp03
Member Avatar for dirzy

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 …

Member Avatar for Mitja Bonca
0
288
Member Avatar for ventura1

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]

Member Avatar for Mitja Bonca
0
185
Member Avatar for timosoft

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 …

Member Avatar for timosoft
0
927
Member Avatar for easterbunny

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() …

Member Avatar for easterbunny
0
4K
Member Avatar for tendaimare

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 …

Member Avatar for Mitja Bonca
0
141
Member Avatar for strRusty_gal

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! …

Member Avatar for Mitja Bonca
0
319
Member Avatar for uva1102

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, …

Member Avatar for Mitja Bonca
0
184
Member Avatar for ali.alipanahi

With Microsoft Sql Server: -- -- Create test case -- DECLARE @myDateTime DATETIME SET @myDateTime = '2008-05-03' -- -- Convert string -- SELECT LEFT(CONVERT(VARCHAR, @myDateTime, 120), 10)

Member Avatar for Mitja Bonca
0
67
Member Avatar for renzlo

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 …

Member Avatar for Mitja Bonca
0
159
Member Avatar for surajrai

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 …

Member Avatar for skatamatic
0
241
Member Avatar for auwi987

Do you use Crystal Reports? You can do that, simply create parameters in your report, and pass values from textboxers to these parameters.

Member Avatar for Mitja Bonca
0
93
Member Avatar for kamilacbe

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 …

Member Avatar for Mitja Bonca
0
171
Member Avatar for tukky

Where come these data of yours that populates gridview? Is gridview databound? Tell us more, so we can help you more.

Member Avatar for M.Waqas Aslam
0
150
Member Avatar for james1on1

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]

Member Avatar for Mitja Bonca
0
266
Member Avatar for poolet25

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]

Member Avatar for M.Waqas Aslam
0
158
Member Avatar for judithSampathwa

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 …

Member Avatar for sathiyapriya.M
0
1K
Member Avatar for Leodumbi

Tital i double type, so convert the value from dataRow to double (use Convert ot parse method).

Member Avatar for Mitja Bonca
0
124
Member Avatar for Om Alooi

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 …

Member Avatar for Mitja Bonca
0
378
Member Avatar for jumboora

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 …

Member Avatar for jumboora
0
900
Member Avatar for eoop.org
Member Avatar for thines01
0
189
Member Avatar for Shodow
Member Avatar for ninjatalon

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)), …

Member Avatar for ninjatalon
0
134
Member Avatar for AleWin

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]

Member Avatar for ddanbe
0
416
Member Avatar for leyla

[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 …

Member Avatar for codeorder
0
177
Member Avatar for dwarvenassassin

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 …

Member Avatar for Mitja Bonca
0
135
Member Avatar for leyla

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 …

Member Avatar for leyla
0
360
Member Avatar for Farhan_B

try: [CODE]strsql = "delete from cg_security_user_right where user_id = '" & TextBox1.Text & "' role_id = '" & TextBox2.Text & "'"[/CODE]

Member Avatar for Phasma
0
153
Member Avatar for ipodtrip

I dount we can help you out with this, maybe you didnt use the correct formulas for calculation. Code it self looks fine.

Member Avatar for Momerath
0
550

The End.