- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 339
- Posts with Upvotes
- 312
- Upvoting Members
- 135
- Downvotes Received
- 22
- Posts with Downvotes
- 20
- Downvoting Members
- 13
... I only want to learn programming decently!
That`s about it.
- Interests
- tennis, football, skiing, karting
1,469 Posted Topics
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: 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. | |
Re: 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] | |
Re: 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 … | |
Re: Try this: [CODE] string a = "12.34"; decimal b = Convert.ToDecimal(a, System.Globalization.CultureInfo.InvariantCulture); [/CODE] | |
Re: 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 … | |
![]() | Re: string myEnum =MyEnum.A.Tostring(); |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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"; … | |
Re: 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 … | |
Re: 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? | |
![]() | Re: private List<string> list = new List<string>(); public List<string> List { get { return list; } set { list = value; } } |
Re: 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", … | |
![]() | Re: Why would you have drives in seperated combo? Wouldn`t be better to have all in treeView? |
Re: 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", … | |
Re: 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() { … | |
Re: 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 … | |
Re: 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). | |
Re: 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... | |
Re: 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 … | |
Re: 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 | |
Re: 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 … | |
Re: 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 … | |
Re: 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] | |
Re: 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] | |
Re: 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. | |
Re: Your code does not return the name string (value) from all over the method. It reutrns only from the while loop. What in case if the code does not go to while loop? It will return what? notihng. But your method return type is a string. That means you have … | |
Re: Create column in a constructor of form (or on load event): [CODE] DataGridViewImageColumn imageColumn = new DataGridViewImageColumn(); { imageColumn.Name = "colImages"; imageColumn.HeaderText = "Images"; imageColumn.Width = 100; imageColumn.ImageLayout = DataGridViewImageCellLayout.Stretch; imageColumn.CellTemplate = new DataGridViewImageCell(false); imageColumn.DefaultCellStyle.NullValue = null; } datagridview1.Columns.Insert(imageColumn, 1); //1 is an index of column - 2nd column [/CODE] … | |
Re: Best would be to give us the code. Then we can point you into the righ direction... | |
Re: You have to find our the screen resolution, and based on that, you then adjust your image (resize it). How to get screen resolution and resize image: [CODE] Dim width As Integer = Screen.PrimaryScreen.WorkingArea.Width Dim height As Integer = Screen.PrimaryScreen.WorkingArea.Height Dim image__1 As Image = Image.FromFile("filePathToImage") Dim newImage As New … | |
Re: Crystal Reports are not included in VS 2010. You have to install them by your self, and you an get them from SAP. Last version of VS that had Crystal Reports was previous one, 2008. | |
Re: 1st of all, dont save - most for - password in a plain text. Use crypting. | |
Re: Hmm, Tellalca? What an answer is that?? If you want to comment threads like that, you better do NOT write at all. Otherwise you will be penelized, ok? Sorry for inconveniances. Ok, back to the thread`s topic, you can bind data from dataTable, which gets filled from database like this: … | |
Re: Hi, would you mind telling us some more about what would you like to achive? I mean what is the source, and what to put together and the output of course. Otherwise salving problems when you have a key and multiple value can really be salved with the Dictionary collections, … | |
Re: Yep.. do it this way: [CODE] Public Sub New() 'in constructor or in load event (before showing actually): comboBox1.DataSource = New BindingSource(table1, Nothing) comboBox1.DisplayMember = "Catname" comboBox1.ValueMember = "Carid" 'subscribe to an event: comboBox1.SelectedIndexChanged += New EventHandler(AddressOf comboBox1_SelectedindexChanged) End Sub 'event: Private Sub comboBox1_SelectedindexChanged(sender As Object, e As EventArgs) 'get … | |
What do I need that I can add a reference to System.Windows.Controls namespace? | |
Re: It would be better to use datasource property of comboBox to pass data from table to comboBox: [CODE] Private Sub Form5_Load(sender As System.Object, e As System.EventArgs) Dim con As New SqlConnection() con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\lito\Documents\QMP_DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" con.Open() Dim da As New SqlDataAdapter("select * from Subject_Info", con) Dim table … | |
Re: [QUOTE=de Source;1583558] i dont have any experience with datagridview so kindly express your solution in bit detail [/QUOTE] hmmm, this will take some time then... ;) Ok, regarding to your thread`s title, you want to pass data from textBox to DGV. You can do it this (Simple) way: [CODE] dataGrivView1[0,0].Value … | |
I am doing some more coding on listView, and I can not figurate it out how to salve the problem that there is always just one checkBox on the listView checked. On the listView I have some names. When I load it there is already a checked name - so … | |
Re: I know it can be creates like: TextBox[] tbsArray = new TextBox[2]; tbsArray[0] = textBox1; tbsArray[1] = textBox2; //or: TextBox[] tbsArray = new TextBox[] { textBox1, textBox2 }; //or in a loop: foreach(TextBox tb in new TextBox[] { textBox1, textBox2 }) { //... } If there is any other way … | |
Re: That you dont have any loop around the code which shows the progressBar? Or maybe you call the method multiple times? Please double check it. | |
Re: Hi, I did much of the code you need. The code retreives the new new date and number. What is checks. - If the date in the stirng retreived from datebase (the last one) if older then today, it creates new "number", with today` date and number 1 after slash … | |
Re: Hello, can you tell yo more about your issue. What exactly is "Udru" language? And what do you have in the has table? Can you show us the code you did? thx Mitja | |
Re: Its hard to tell what can be wrong - obviousely the code hangs somewhere in between, in some loop. That means that the code came into an infinitive loop - it will circle forever. Why? I cannot tell you... but can you please share you code here, so we can … | |
Re: Try with using HasSet collection: [CODE] class Program { static void Main(string[] args) { string[] array = { "a", "b", "c", "b", "d", "e", "c" }; string[] result = RemovingDuplicates(array); } private static string[] RemovingDuplicates(string[] array) { HashSet<string> set = new HashSet<string>(array); string[] result = new string[set.Count]; set.CopyTo(result); return result; … | |
Re: Have you ever worked with retrieving data from dataBase, using sqlCOnnection? What you have to do is: Ok I have done a simple example of how to use parameters - pass them between methods and populate contols with them. [CODE] private void button1_Click(object sender, EventArgs e) { string item = … |
The End.