Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

wi5nia

@wi5nia
About
Posts
7
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Regular expression problem
    W wi5nia

    but it's not a xml document and XmlDocument in that case sometimes doesn't do its job good so thats why I want to use reg. ex.

    C# question regex help tutorial

  • Regular expression problem
    W wi5nia

    hi, I have a question about RE. Lets say I have this string: Text I get the "Text" by using this RE: MatchCollection m = Regex.Matches(wynik,@"\"">\s*(.+?)\s*"); I use MatchCollection beacuse I do it on a bigger file but for the ease of writing ths post I'm just an example of one line. Then on my collection I do a foreach and each Text is set as an Item Label in a dropDown list. But in the m regex I would also like to get the "comment" so then in my foreach loop I would be also able to assign it to the items Tag lets say. How can I achive this?

    C# question regex help tutorial

  • Bindng and display problem
    W wi5nia

    the second solution works like a charm :) many thanks

    C# database csharp sql-server wpf winforms

  • Bindng and display problem
    W wi5nia

    no, I just want to show a list of LastNames from the table, and if there is a NULL value for the LastName column in a given row then show for that row the value from the column Company

    C# database csharp sql-server wpf winforms

  • Bindng and display problem
    W wi5nia

    so what solution would suggest?

    C# database csharp sql-server wpf winforms

  • Bindng and display problem
    W wi5nia

    hi, I have this problem which I have been trying to solve for some time but with no result :( I have a table in sql server which consists of two columns: LastName and First name, and a result for a "select * from TestTable" is: Doe John NULL Mark Then a I have a piece of code in my WinForms application:

    string connString = "server=.;database=Test;Integrated Security=SSPI;";
    string sql = "select LastName, FirstName from TestTable";
    SqlConnection conn = new SqlConnection(connString);
    SqlDataAdapter da = new SqlDataAdapter(sql, conn);
    DataSet dataset1 = new DataSet();
    da.Fill(dataset1, "TestTable");
    DataTable dt = dataset1.Tables["TestTable"];

            listBox1.DataSource = dt;
    
            if (listBox1.DisplayMember.Length != 0)
            {
                listBox1.DisplayMember = "LastName";
            }
            else
            {
                listBox1.DisplayMember = "FirstName";
            }
    
            textBox1.DataBindings.Add("text", dt, "LastName");
            textBox2.DataBindings.Add("text", dt, "FirstName");
    

    and it works fine, when there is a NULL value in teh LastName column, in the listBox the FirstName is diplayed. The binding works ok Now when I alter the table and add another column (Company), the same sql query result looks like that: Doe John NULL Smith Mark NULL NULL NULL Microsoft Now when I make changes to the code to looke like this:

    string connString = "server=.;database=Test;Integrated Security=SSPI;";
    string sql = "select LastName, FirstName, Company from TestTable";
    SqlConnection conn = new SqlConnection(connString);
    SqlDataAdapter da = new SqlDataAdapter(sql, conn);
    DataSet dataset1 = new DataSet();
    da.Fill(dataset1, "TestTable");
    DataTable dt = dataset1.Tables["TestTable"];

            listBox1.DataSource = dt;
    
            if (listBox1.DisplayMember.Length != 0)
            {
                listBox1.DisplayMember = "LastName";
            }
            else
            {
                listBox1.DisplayMember = "Company";
            }
    
            textBox1.DataBindings.Add("text", dt, "LastName");
            textBox2.DataBindings.Add("text", dt, "FirstName");
            textBox3.DataBindings.Add("text", dt, "Company");
    

    in the listBox I only get the Microsoft entry. The other entries are there but are not visible by the LastName but b

    C# database csharp sql-server wpf winforms

  • Update TextBox from second Form
    W wi5nia

    hi, I have and application which has 2 forms. The firts form has a textbox and a button which clicked opens a second form, which has just one button which clicked calls a method in the first form. The problem is, that the textbox doesn't update. There are no excpetion, when I set a break point the program goes into the line which updates the textbox but nothing happens. What is wrong?

    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        public void add()
        {
            textBox1.Text = "Test";
        }
    
        private void button1\_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.Show();
        }
    }
    

    public partial class Form2 : Form
    {
    public Form2()
    {
    InitializeComponent();
    }

        private void button1\_Click(object sender, EventArgs e)
        {
            Form1 f1 = new Form1();
            f1.add();
        }
    }
    
    C# question help announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups