1,469 Posted Topics

Member Avatar for darkelflemurian

How to use a invokeRequired method while you have to invoke a control over threads shows the exmple code with using Delegates bellow: [CODE] Private Delegate Sub MyDelegate(msg As String) Private Sub FillingListBox(value As String) If listBox1.InvokeRequired Then listBox1.Invoke(New MyDelegate(AddressOf FillingListBox), New Object() {value}) Else listBox1.Items.Add(value) End If End Sub …

Member Avatar for darkelflemurian
0
162
Member Avatar for deucalion0

Its impossible to tell you what it should be. I or we (at least for those who dont know this example, and I dount anyone here does), doubt its possible to predict how the inheritance shoud be in yout particular exampe. There is much to learn on this area of …

Member Avatar for deucalion0
0
136
Member Avatar for christos312
Member Avatar for xanawa

Try to create parameters, rather then passing values in the query it self, using sqlCommand: [CODE] void InsertMethod(string a, int reservation) { using (SqlConnection sqlConn = new SqlConnection("connString")) { string sqlQuery = String.Format(@"INSERT INTO tblOrders VALUES (A = @a, B = @b)"); SqlCommand cmd = new SqlCommand(sqlQuery, sqlConn); cmd.Parameters.Add("@a", SqlDbType.VarChar, …

Member Avatar for xanawa
0
252
Member Avatar for sushanth08

Hi, would you mind showing us the code you got there - would be faster to salve the issue. Thx in advance.

Member Avatar for Mitja Bonca
0
120
Member Avatar for Behseini

You have to use a DataReader class to get a value our of database: [CODE] string cmd = "Select FName From Emp Where EmpID = 20"); OracleCommand oc = new OracleCommand(cmd, oraConnection); //open a connection: oraConnection.Open(); OracleDataReader reader = command.ExecuteReader(); string result = null; if(reader.Read()) result = (string)reader[0]; reader.Close(); oraConnection.Close(); …

Member Avatar for Mitja Bonca
0
236
Member Avatar for IDC_Sharp

Ok, I saw this post of yours, and what I want now is a decent explanation of the problem. I will not even look into code of yours, but I need some words what you need to do. Simple.

Member Avatar for Razer_90
0
144
Member Avatar for tstory28
Member Avatar for samueal

Hello, take a look at this example: [url]http://www.c-sharpcorner.com/UploadFile/mahesh/CreatingDBProgrammaticallyMCB11282005064852AM/CreatingDBProgrammaticallyMCB.aspx[/url] it might come right.

Member Avatar for samueal
0
80
Member Avatar for Pgmer

What do you think of something like this: [CODE] Class Program Private Shared Sub Main(args As String()) 'example of 4 rows and 2 columns: 'particular bracket: '1st number is value of checkBox (1 is Checked, 0 is not checked) '2nd number is value of text existance (1 text exist, 0 …

Member Avatar for Pgmer
0
132
Member Avatar for twigan1015

If I understand you well, you would like to copy content of the dataBase to a textFile. But only the data, or th whole structure, like sql has with "Export" option?

Member Avatar for hdaccess
0
301
Member Avatar for Naveed_786

Is there any error, when trying to run the 2008 project in VS 2010, or the file simply doesnt start? Usually, an older version, should start in the newer software, so I dont know the cause of the issue. We can check and do one thing. Run the project`s sln …

Member Avatar for Mitja Bonca
0
179
Member Avatar for mogaka

Hi, check for the solution [URL="http://www.bigresource.com/Tracker/Track-ms_sql-CBrwA3u0/"]here[/URL].

Member Avatar for Mitja Bonca
0
70
Member Avatar for moshe12007

Why dont you better create two dataTable for Men and Women, and put both into the dataSet? [CODE] using (SqlConnection sqlConn = new SqlConnection("connString")) { DataSet ds = new DataSet(); SqlDataAdapter da; SqlCommand cmd; DataTable table1 = new DataTable("Men"); DataTable table2=new DataTable("Women"); //fill men`s table: string query1 = @"SELECT * …

Member Avatar for shine_jose
0
186
Member Avatar for Behseini

[CODE] for(int i = 0; i< lstCols.Items.Count; i++) { if((i +1) < lstCols.Count) textBox1.Text += lstCols.Items[i] + ", "; else textBox1.Text += lstCols.Items[i]; } [/CODE]

Member Avatar for abelLazm
0
2K
Member Avatar for moone009

You cannot use an UPDATE statement and then use the Datareader method. This one is for reading data (when doing SELECT statement).

Member Avatar for abelLazm
0
87
Member Avatar for sarifah n

Try using TextmWriter object: [CODE] Dim text1 As String = "Some text in the line" Dim text2 As String() = {"a", "b", "c"} Dim path As String = "c:\myFile.txt" 'fill will be create (if not exists) on the c: drive Using fs As New FileStream(path, FileMode.OpenOrCreate) Using tw As TextWriter …

Member Avatar for sarifah n
0
115
Member Avatar for GaBack

You do not pass the parameters to the event. If there is no actual parameters need, you can pass null, like: [CODE] private void but1_Click(object sender, EventArgs e) { load.ClickHandler(null, null); } [/CODE]

Member Avatar for GaBack
0
252
Member Avatar for xanawa

Heres an exmample: [CODE] private Bitmap transparentImage; public Form1() { InitializeComponent(); transparentImage = new Bitmap(20, 20); Graphics graphics = Graphics.FromImage(transparentImage); graphics.FillRectangle(Brushes.Transparent, 0, 0, 20, 20); graphics.Dispose(); DataGridViewImageColumn imageColumn = new DataGridViewImageColumn(); { imageColumn.Name = "imageColumn"; imageColumn.HeaderText = "Images"; imageColumn.Width = 100; imageColumn.ImageLayout = DataGridViewImageCellLayout.Stretch; imageColumn.CellTemplate = new DataGridViewImageCell(false); imageColumn.DefaultCellStyle.NullValue = …

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

Yee, look this code: [CODE] int intClicks; private void button1_Click(object sender, EventArgs e) { intClicks++; MessageBox.Show("button has been clicked " + intClicks + (intClicks == 1 ? " time." : " times.")); } [/CODE]

Member Avatar for kirtee2209
0
3K
Member Avatar for moone009

The problem is in your Select statement. You only select one value (address1), but in the read you want to retreive two values (reader[0] and reader[1]). Solution: or you add two values into select statement, or you remove reader[1] from the while loop. 1.: [CODE] cmd.CommandText = "select address1, address2 …

Member Avatar for Mitja Bonca
0
365
Member Avatar for xanawa

This is the even of some control. This will fire a always file on the form load, becuas the dataGridView always selects the [0,0] based sell - this is upper, left cell. And when it does, the event fires up. What you can do, to prevent executing the code on …

Member Avatar for xanawa
0
218
Member Avatar for santhya.rps1986

Would you like to show me the code? To see what it might be the problem, thx in advance.

Member Avatar for Mitja Bonca
0
58
Member Avatar for djansyle

Hi, check it out here: [url]http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.sendfile.aspx[/url]

Member Avatar for Mitja Bonca
0
200
Member Avatar for djansyle

Hi, you will have to use convert image to a byte array and then back to image. [CODE] 'server/write Dim len As Long = sendBytes.Length Dim Bytelen() As Byte = BitConverter.GetBytes(len) 'send the size of Data first networkStream.Write(Bytelen, 0, Bytelen.Length) 'add write size of Data 2011/3/3 networkStream.Write(sendBytes, 0, sendBytes.Length) '----------------------------------------------------------------------- …

Member Avatar for Mitja Bonca
0
88
Member Avatar for Arjun_Sarankulu

I hope this thing is not one method Mitja. This is what is commonly referred to as a [URL="http://en.wikipedia.org/wiki/Code_smell"]code smell[/URL]. Btw, you could tell us where this error uccur. I wont look not the whole code to find you the error in it.

Member Avatar for Arjun_Sarankulu
0
173
Member Avatar for Jazerix

You have to pass a value to the 1st subitem of the listView, like that: [CODE] string name = "SomeName"; int id = 2; ListViewItem lvi = new ListViewItem(); lvi.Text = name; lvi-Subitems.Add(id.ToString()); listView1.Items.Add(lvi); [/CODE] If you want to insert in a specific row, you have to create a loop …

Member Avatar for Sravanthi Ch
0
117
Member Avatar for Sravanthi Ch

How to invert? From last to 1st? By which column (items, or subItems)? I need more information.

Member Avatar for Sravanthi Ch
0
386
Member Avatar for newack

Defenatelly. Expired version in useless now. I am a student too, and I got a lot of software from Microsoft for free as well. Why not using it, if its leagal, and free of charge.

Member Avatar for Mitja Bonca
0
79
Member Avatar for niketakapoor

If you are updating an existing row in the dataTable, you MUST put a comparison, this is a WHERE clause in the sql query. And you cannot update ID, which is a uniqe key. The Id you have to use to compare which row you have to update. How you …

Member Avatar for Mitja Bonca
0
91
Member Avatar for niketakapoor

Is should be like this: [CODE] datagridview1.columns[1].HeaderText = "memberID"; [/CODE] columns at index 1 means that the code will chnage the header text in the 2nd column (looking from left to right).

Member Avatar for Mitja Bonca
0
79
Member Avatar for aska07

Here is the working code: [CODE] Public Sub New() InitializeComponent() Dim ds As New DataSet() Dim table As New DataTable("MyTable") ds.Tables.Add(table) 'my example columns creating and population: table.Columns.Add(New DataColumn("id", GetType(Integer))) table.Columns.Add(New DataColumn("code", GetType(String))) table.Columns.Add(New DataColumn("desc", GetType(String))) table.Rows.Add(1, "ADV", "ADVANCE") table.Rows.Add(2, "ADV", "ADVANCE") table.Rows.Add(3, "BUS", "BUS TICKET") table.Rows.Add(4, "BUS", "BUS TICKET") …

Member Avatar for aska07
0
159
Member Avatar for xanawa

Becuase you cannot assign a null value to the Text property of the textBox. You can do a checking if the value is null or not: [CODE] if(c.IDCardNumber != null) txtIDCardNo.Text = c.IDCardNumber.ToString(); else txtIDCardNo.Text = ""; [/CODE]

Member Avatar for xanawa
0
105
Member Avatar for bhagvad301

Did you forget to include any reference or application files to the installer? Go to your project, into Solution explorer, right mouse click on the Project name, and select Properties. Go to Publish tab, and click on Application Files and Prerequisites. Check in both if there is anything missed out …

Member Avatar for abelLazm
0
2K
Member Avatar for araib

For progressBar: Use a System.Windows.Timer class. You only have to get the total time and then set the beginning and the end of the timer. Use Tick event of the timer, to move the progressBar forward. Heres an example: [CODE] private void InitializeMyTimer() { // Set the interval for the …

Member Avatar for araib
0
174
Member Avatar for Jake110
Member Avatar for james6754

Do it this way: [CODE] SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { //save file using textWriter object! } [/CODE]

Member Avatar for james6754
0
320
Member Avatar for bluehangook629

Do it this way: [CODE] Private NewMDIChild As frmReportProblem Private Sub miReportProblem_Click(sender As System.Object, e As System.EventArgs) If NewMDIChild Is Nothing Then NewMDIChild = New frmReportProblem() NewMDIChild.MdiParent = Me NewMDIChild.Show() End If End Sub [/CODE]

Member Avatar for bluehangook629
0
121
Member Avatar for moose333

If you want to get together the data in individual column, you better create as many arrays (or even better generic lists) as you have columns. When you will read line by line, you put 1st value into 1st column, 2nd value into 2nd column, and so on. On the …

Member Avatar for Mitja Bonca
0
298
Member Avatar for YMCMb

Check out this code: [CODE] Private Sub textBox1_KeyPress(sender As Object, e As KeyPressEventArgs) 'allows backspace key If e.KeyChar <> ControlChars.Back Then 'allows just number keys e.Handled = Not Char.IsNumber(e.KeyChar) End If End Sub [/CODE]

Member Avatar for crishjeny
-1
125
Member Avatar for xanawa

YOu can do it this way: [CODE] //form1: public Form1() { InitializeComponent(); label1.Text = ""; } private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(this); f2.Show(); } public void PassDataFromForm2(decimal value) { label1.Text = value.ToString(); } //form2: Form1 f1; public Form2(Form1 _f1) { InitializeComponent(); this.f1 = _f1; …

Member Avatar for xanawa
0
101
Member Avatar for xanawa
Member Avatar for xanawa

Sure it is. What you have to so, is to create a new Form, that will look like a messageBox. Put a textBox on it, and a buttons (Ok, Cancel, or what ever). Simple.

Member Avatar for Mitja Bonca
0
4K
Member Avatar for sathish88

This is a base example of using connection string, but it works: [CODE] static string connString = @"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"; private YourMethod() { using (SqlConnection sqlConn = new SqlConnection(connString)) { sqlConn.Open(); //do inquieries: string sqlQuery = @"SELECT ... FROM ... WHERE"; } } [/CODE] Use your correc connection string!

Member Avatar for mono_jit23
0
162
Member Avatar for studentoflife

I hope you are talking aobur DataTables. Simple name them by some uniqe name. If there is no other way, you can use numbers from 1 to 30 (as jockeyvn proposed), or use the name from sql table (table1, table2,table3 - if they are all different). Or use more sql …

Member Avatar for studentoflife
0
199
Member Avatar for IDC_Sharp
Member Avatar for xanawa

Ar you sure your 8th column shows this value? Because you stated it as column index no. 7. And one more think: what is it doing this loop: [CODE] foreach (int t in listOfReservationTables) { tables = tables + "," + t.ToString(); } [/CODE] This for sure is not summing …

Member Avatar for xanawa
0
160
Member Avatar for Belk

You can use a get set modifier ( a static one, so you will not need to initialize a new form1), and one time you read the text from it, 2nd time you set the text from it: [CODE] //Form1: public static string MyText { get; set; } //this is …

Member Avatar for Belk
0
76
Member Avatar for kieky

Why is your method type of string. You want to get a number, number of comments, so you should work and return an integer. What represents this line of code: [CODE]var comment = db.DMSDataContext.Comments.Where(p => Convert.ToString(p.IdTopic) == IdTopic);[/CODE] I see you aretrying to use Linq query over some objects. Do …

Member Avatar for Mitja Bonca
0
101
Member Avatar for newack

This book you are using, uses some strange expressions. It should be written like: Create a dataTable, then do an sql query to fill this table up, and bind it to the dataGridView. In the code this would look like: [CODE] DataTable table; private void GetData() //call this method when …

Member Avatar for Mitja Bonca
0
136

The End.