Posts
 
Reputation
Joined
Last Seen
Ranked #86
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
94% Quality Score
Upvotes Received
339
Posts with Upvotes
312
Upvoting Members
135
Downvotes Received
22
Posts with Downvotes
20
Downvoting Members
13
113 Commented Posts
~889.54K People Reached
About Me

... I only want to learn programming decently!
That`s about it.

Interests
tennis, football, skiing, karting
Favorite Tags
Member Avatar for Matthew N.

Use this: Imports System.Runtime.InteropServices Imports System.Text Namespace Ini ''' <summary> ''' Create a New INI file to store or load data ''' </summary> Public Class IniFile Public path As String <DllImport("kernel32")> _ Private Shared Function WritePrivateProfileString(section As String, key As String, val As String, filePath As String) As Long End …

Member Avatar for jehernandez757
0
3K
Member Avatar for Fiascor

back to topic question: [CODE] //constructor: public Form1() { this.button1.Visible = false; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (this.checkBox1.Checked) this.button1.Visible = true; else this.button1.Visible = false; } [/CODE]

Member Avatar for JamesCherrill
0
1K
Member Avatar for RudolfRyan

Is your DGV bind to dataSource? If so you can do a filter with "SUM Columns", which will ack like an sql query. If you dont use any dataSource, you can loop through rows and sum cell in this partiucular column, like: [CODE] decimal total = 0; foreach (DataGridViewRow row …

Member Avatar for puppynp
0
2K
Member Avatar for Z33shan

YOu have to be aware of one thing: when you close the form (main form you named it), which has been started from Program class with: Application.Run(new Form1()); The application will close. To avoid this, you have to take care of closing all other form before this one.

Member Avatar for Samuel_25
0
1K
Member Avatar for sidyusuf

I would rather choose KeyPress event, where you can use "e" parameter and set its Handled property: [CODE] Private Sub textBox1_KeyPress(sender As Object, e As KeyPressEventArgs) If textBox1.Text.Length >= 10 Then If e.KeyChar <> ControlChars.Back Then e.Handled = True End If End If End Sub [/CODE]

Member Avatar for ddanbe
0
16K
Member Avatar for virusisfound

YOu cannot read a whole row of the dgv to a string. Ok, you can, but there will be no value you want to have. So you have to specify from which column and from which row you want to get the value. Lets repair your code: [CODE] //just make …

Member Avatar for pritam_4
0
6K
Member Avatar for charlybones

Try this: [CODE] string a = "12.34"; decimal b = Convert.ToDecimal(a, System.Globalization.CultureInfo.InvariantCulture); [/CODE]

Member Avatar for DOUGLAS_9
0
19K
Member Avatar for zifina

I would rather put the code which is not in the button Click event into a new method. Then you call this method in button clck in that form, and from another form, like: [CODE] //other form whih has a button click event: private void button_Click() { MethodToExecute(); } public …

Member Avatar for Andressa_1
0
5K
Member Avatar for ffonz
Member Avatar for fredw300

I`m afraid not. There is plenty of data to save. You can create a progressBar, which will show the progress of saving, and create a new thread which will do the saving (and restoring data back to richTextBox). Btw: but even the type varchar should do it. Maybe you didn`t …

Member Avatar for Hak_1
0
5K
Member Avatar for gozo12

Add a new class into your project and paste this code: [CODE] Imports System.Windows.Forms Public Class BetterListBox Inherits ListBox ' Event declaration Public Delegate Sub BetterListBoxScrollDelegate(Sender As Object, e As BetterListBoxScrollArgs) Public Event Scroll As BetterListBoxScrollDelegate ' WM_VSCROLL message constants Private Const WM_VSCROLL As Integer = &H115 Private Const SB_THUMBTRACK …

Member Avatar for Xavier_5
0
3K
Member Avatar for harsh01ajmera

Check out this way by using DialogResult (and passing data between forms or classes): 'PROGRAM class Class Program ''' <summary> ''' The main entry point for the application. ''' </summary> <STAThread()> _ Private Shared Sub Main() Application.EnableVisualStyles Application.SetCompatibleTextRenderingDefault(false) Dim loginData As String = "" Dim l As Login = New …

Member Avatar for Varun_9
0
3K
Member Avatar for prethum

Try to bind data. I mean, fill dataTable and bind it to dgv: [CODE] //retreive data from db to datatable: SqlDataAdapter adpat = new SqlDataAdapter(); adpat.SelectCommand = new SqlCommand("select * from ImgTB", con); DataTable table = new DataTable("myTable"); adpat.Fill(table); //create image column: DataGridViewImageColumn photoColumn = new DataGridViewImageColumn(); photoColumn.DataPropertyName = "Picture"; …

Member Avatar for coolcurrent4u
0
3K
Member Avatar for san_gwapo19

Here is my example code (which i did some time ago) and actually used is some where: [CODE] Public Shared Function NumberToWords(number As Integer) As String If number = 0 Then Return "zero" End If If number < 0 Then Return "minus " & NumberToWords(Math.Abs(number)) End If Dim words As …

Member Avatar for JamesCherrill
-1
4K
Member Avatar for Leon Guerrero

I actually dont understand what is wrong with your code based on your description. Do you want to try to add text from some other class to textbox?

Member Avatar for Erdogan
0
3K
Member Avatar for Falcon25

private List<string> list = new List<string>(); public List<string> List { get { return list; } set { list = value; } }

Member Avatar for JOSheaIV
0
19K
Member Avatar for missc

Check out this code. The 1st part is only a simple dgv population. Then is the code which color the rows: [CODE] public Form1() { InitializeComponent(); dataGridView1.Columns.Add("col1", "column 1"); dataGridView1.Columns.Add("col2", "column 2"); dataGridView1.Rows.Add(1, "Canceled"); dataGridView1.Rows.Add(2, "Ok"); dataGridView1.Rows.Add(3, "Canceled"); dataGridView1.Rows.Add(4, "Canceled"); dataGridView1.Rows.Add(5, "Ok"); foreach (DataGridViewRow row in dataGridView1.Rows) { if (dataGridView1["col2", …

Member Avatar for ian rey
0
6K
Member Avatar for cool_intentions
Member Avatar for abdulmoaiz
0
2K
Member Avatar for compulove

Get all the textBoxes into an array, and read them (using Text property) into a StringBuilder class. Then write all to a text file: [CODE] Textbox[]tbs = { textBox1, textBox2, textBox3 }; // add all of them in here StringBuilder sb = new StringBuilder(); foreach(TextBox tb in tbs) sb.AppendLine(tb.Text); System.IO.File.WriteAllText(@"C:\myFile.txt", …

Member Avatar for ddanbe
0
208
Member Avatar for newack

No, you have to put the instance of the Random on the class level, then you will not have problems with getting random number every where (on load event, or on some button click event, or in some method): [CODE] //form1 class: Random r = new Random(); public Form1() { …

Member Avatar for lexii
1
396
Member Avatar for Behseini

Iam affraid you cannot put images into a listBox (without any additional hacking of the code). I would better suggest you to use ListView, which is meant for it.8df **Images to lsitview:** If you want to do this in the designer, you can take the following steps to add the …

Member Avatar for macgurl70
0
4K
Member Avatar for gurusamy

Me neither :) List<T> is best option. Maybe for some "simple" arrays its better to use a simple array, like string[], or int[]. But if you have a custom object, List is better choice, and even better is a generic list (List<T> - as Momerath described in the previous post).

Member Avatar for RichardGalaviz
0
557
Member Avatar for Wiizl

This is another version of updating Label`s text over the thread: [CODE] delegate void LabelDelegate(string message); public Form1() { InitializeComponent(); } private void UpdatingLabel(string msg) { if (this.label1.InvokeRequired) this.label1.Invoke(new LabelDelegate(UpdatingLabel), new object[] { msg }); else this.label1.Text = msg; } [/CODE] Its faster and easier...

Member Avatar for Matthew.diggide.speakman
0
7K
Member Avatar for jeffreylee

You can create a new connection from Server Explorer and copy connection strings from properties in your project. Following link contains steps to create connection from Server Explorer [url]http://msdn.microsoft.com/en-us/library/s4yys16a(v=VS.90).aspx[/url] You can try following Connectionstring Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; You can also get list of connection string from [url]http://connectionstrings.com/sql-server-2008[/url] ---------------------------------------------------------------------------------------------------- Do …

Member Avatar for vdixit01
0
828
Member Avatar for ajinkya112

Hi, I would recommend you to fill DataTable from DGV, but there is still not in-built way to do so. check this link: http://stackoverflow.com/questions/4720463/how-to-export-from-datatable-to-pdf-in-wpf

Member Avatar for jaga.dish.39
0
270
Member Avatar for ariez88

Did you bind the listBox1, using DataSource property from DataTable? If so, you have to 1st get the item and value from listBox item and add it some other place (in your case to listBox2): [CODE] for(int i = 0; i < listBox1.SelectedItems.Count; i++) { DataRowView view = listBox1.SelectedItem as …

Member Avatar for samkri
0
798
Member Avatar for lxXTaCoXxl

Yes it it, or even better it to use: [CODE]this.Dispose();[/CODE] The basic difference between Close() and Dispose() is, when a Close() method is called, any managed resource can be temporarily closed and can be opened once again. It means that, with the same object the resource can be reopened or …

Member Avatar for padillian
0
2K
Member Avatar for caello

I would go to use >= and <= operators to define the start end end date accordingly: [CODE]Dim query As String = "Select * from AFINITY where Description = @description and Datetgl >= @startDate and Datetgl <= endDate"[/CODE]

Member Avatar for jared.geli
0
2K
Member Avatar for vivekagrawal

You do: [CODE] //form1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(textBox1.Text); f2.Show(); } } //form2: public partial class Form2 : Form { public Form2(string value) { InitializeComponent(); textBox1.Text = value; } } [/CODE]

Member Avatar for hilahilarious
0
8K
Member Avatar for yousafc#

Hi, check [URL="http://www.codeproject.com/KB/aspnet/ImageInDatabase.aspx"]here[/URL]. Remember you have to get Byte array (byte[]) from picture to save it into a dataBase.

Member Avatar for mostafarafi
1
5K