Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Bill Zdarko

Greenhorn
+ Follow
since Aug 11, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Zdarko

Or

if it is much easier in a visual view, can I get a step by step on how to make a change in a dropdown effect the contents of a datagridview.

5 years ago
Hello.

I am creating a very simple desktop app using visual studio express for C#.

I have a database with two tables.
One is the header - it has an auto number field and a text name field.
The other table has 5 parts, auto number, IndexTableOne, Description, date, outdated(truefalse)
first table looks like this.
1 Section one
2 Section two
3 Section three
4 Section four
table two looks like this
1 1 bunchoftext 1/2/2012 no
2 1 bunchoftext 1/2/2012 no
3 2 bunchoftext 1/2/2012 no
4 3 bunchoftext 1/2/2012 no
5 1 bunchoftext 1/2/2012 no
6 4 bunchoftext 1/2/2012 no

I created a connection to the database using the menu options in Visual studio. I know I can do a bunch of drag and drop stuff but I want to be able to go into the code and make a new data set and run SQL queries on the existing data connection.
The current data connection is called _implimentDataSet and shows both tables inside of it.


The application will have a drop down box that will be populated by a database (table one). When I select a section in the drop down, I want the table to only show the second table in a dataview of only that section.
if I select section one I want to have the dataview show only where the second field is 1.
So I want a sql statement
Select *
From _implimentDataSet
WHERE fieldone = fieldtwo
I can handle the SQL statement, what I want to know is how to make a method that when my drop down changes that it will select do this.

My problem.
How to I make a dataset? I do not want to use menus and drag n drop, I want to write this in code.
So far I have DataSet ds = new DataSet();
now how do I make this new dataset to look in the _implimentDataSet that has been created?

Thank you.

-Bill
5 years ago
After playing with it some more, here is what I found that was changed.

then each slider was changed to sl rather than calling a new SliderListener()
this makes me think that before, each slider was using a different instance of the class SliderListener,
now they are using the same object or instance.

THe code in the SliderListener is mainly this.

the listener is turn off, a change is made, its turned back on. Nice!

I think the only thing I do not get is this,

both source and mphSlider are JSliders. I did not think that it was possible to compare with == to
non-primitive objects.

Thanks again.

-Bill
5 years ago
You guys are awesome. I didnt expect a solution for a few days. Im sure I will use this site alot, knowing its friendly and quick.

Thanks again.

-Bill
5 years ago
Hi guys, I am taking Java classes at a college level.
I am playing around with JSliders and an addChangeListener.

The gist of my code is I have two sliders, one is MPH the other is KPH. When one slider is slid, the two fields update and the other slider follows. if you move the other slider, the same happes.
My problems seems that when the addChangeListener updates the other slider, it calls the same addChangeListener and then they both stick at 0.

I am using an if statement to run seperate commands depending on which slider calls the addChangeListener.

in this code if I uncomment the statements to update the other slider in the addChangeListener then it doesnt work, with them commented, the other slider does not update.

Im stuck.

Thanks

-Bill

Here is my code.

5 years ago