Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello I am following this Visual Basic instruction and I am doing exactly what it says, except in C# and nothing is working. Below is the link of the video I am referring to. How can I get this same code to work for C#? I am referring to the filter and the combo fox sections in the video, I already know how to do the first half. Any help I would greatly appreciate!!! Thanks



http://windowsclient.net/learn/video.aspx?v=142067[^]
Posted
Comments
Rob Branaghan 29-Jun-10 4:41am    
What exactly isnt working?
which area?
Christian Graus 21-Jul-10 22:34pm    
Reason for my vote of 1
I'm sorry, I just don't like this person. He is racist, abusive, and appears to be doing paid work when he has no idea what he is doing

Ok I have it working in C# (Using my Database (Not northwind))

C#
private void Form1_Load(object sender, EventArgs e)
      {
          // TODO: This line of code loads data into the 'dEV_ROB_KSWDataSetCountryList.vCustomers' table. You can move, or remove it, as needed.
          this.vCustomersTableAdapter1.Fill(this.dEV_ROB_KSWDataSetCountryList.vCustomers);
          // TODO: This line of code loads data into the 'DEV_ROB_KSWDataSet.vCustomers' table. You can move, or remove it, as needed.
          this.vCustomersTableAdapter.Fill(this.DEV_ROB_KSWDataSet.vCustomers, "GB");
          this.reportViewer1.RefreshReport();
      }
      private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
//I put a try catch in here as it fell over at first using the SelectedItem.ToString() so try Catch saved it falling over in Debug :)
          try
          {
              this.vCustomersTableAdapter.Fill(this.DEV_ROB_KSWDataSet.vCustomers, comboBox1.SelectedValue.ToString());
              this.reportViewer1.RefreshReport();
          }
          catch (Exception)
          {
//I know, bad practice of suppressing exceptions.... :(
          }
      }



I also added the items to the combobox dynamically.
(I had to add a seperate DataSet though, as it didnt want to let me filter the current one, and it made my life easier)

SELECT DISTINCT [Default Country Code], [Default Country] FROM dbo.vCustomers


Hope this helps you, if still no joy I will try and upload the project somewhere.
 
Share this answer
 
Comments
[no name] 30-Jun-10 2:48am    
Can you post or email me the project file? It just is not filtering anything for me and is actually deleting all the information from the database when I select an item from the combo box, it is very strange.
Rob Branaghan 30-Jun-10 4:26am    
I am a little concerned that it is deleting the information from the database when you select and item! That would tell me there is a huge problem with your SQL!
:(


I am still having difficulty with this for some reason. Maybe you or someone can now give a short step by step for this? Again, thank you everyone for the help.

:((
 
Share this answer
 
v2
Comments
Sandeep Mewara 29-Jun-10 16:54pm    
1. What reason? What difficulty? Update question with it
2. To interact for an answer, use 'Add comment'
Christian Graus 21-Jul-10 22:34pm    
Reason for my vote of 1
OP is rude and ignorant, posts comments as answers ( on several threads ), etc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900