Dec 29, 2011
I am working on an application that ties into a SQL database on the back end. Currently the main form contains a series of combo boxes (Graph type, data format, location, and customer), two date pickers, and a button to launch the selections in a new form. Everything works just fine except there are a couple of things I can't seem to accomplish.
View 1 Replies
Case Select (with commented out lines for variations attempted):
1) I would like to be able to use some sort of case statement to color the bars in my chart based on value. I have tried approaching this in a couple of different ways but neither of the options seem to work. First, I tried this (the If Not is used because depending on what values are passed to the stored procedure in SQL, different columns will be returned):
Only one series is created with this method, so I can see how/why a Select Case would set all bars the same color. I have also tried creating a series for each row in the returned dataset but it results in 22 bars of different colors, for each of the rows (484 bars):
So is there any way to modify the second set of code there to only select the value from the "Percent TMHB" cell that corresponds with Row(i), rather than ALL values from the "Percent TMHB" column for EACH Row(i)?
2) Since I am drawing/creating these graphs in a new window, is there any way to also create a new timer on the "newFrm" and have the tick refresh the data? I've struggled with this but I feel like it should be easy. Say someone chooses a "TMHB", "Percentage", "Chicago", "All" (Graph type, data format, location, customer) and launches the graph, which opens in a new window, then they want to do "TMHB", "Percentage", "LA", "All" and have both windows up, refreshing automatically throughout the day. Can I somehow store the SelectCommand.Parameters values in the new form/timer so that it will query the database again every 5 minutes?
Example code for the StoredProcedure and creating the new form:
If combo_GraphType.SelectedItem = "TMHB" Then
Dim newFrm As New Form
Dim newChart As New Chart