|
|
I'd have to say this smells badly of spam - it's a limited trial of a paid-for app, and you've been here long enough to know that is the kind of thing that attracts "spam" and "spammer" votes and gets your account closed. Particularly when it's a "special promo" for CodeProject as the link implies.
I don't think spam was your intention, but I'd strongly suggest that you remove the link before it gets reported in S&A and you get kicked out.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Doesn't look like it is in the stage of getting feedback for the first time. I suggest you look for feedback from your current userbase
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi All
i am trying to populate a graph from a datagridview
(Not sure if this is the best practice)
i am using a sql pivot script that populates the correct data into the datagrid
It is showing the years (last 3) in column 0 and 12 months starting from column 1.
How do i show 3 series (for the years) and the 12 months on X and the value of each month on Y.
Below my code
Thank you very much
private void DoGraph(string Title)
{
string ConString = CString;
string CmdString = string.Empty;
using (SqlConnection con = new SqlConnection(ConString))
{
dataGridViewYears.DataSource = null;
CmdString = " SELECT *" +
" FROM(" +
" SELECT" +
" year(Date) as [year], left(datename(month, date), 3) as [month]," +
" SalesCatRoom as YearSales" +
" FROM tblBudgetMaster" +
" WHERE DATEPART(yy, date) >= 2015 AND DATEPART(yy, date) <= 2017" +
" ) as s" +
" PIVOT" +
" (" +
" SUM(YearSales)" +
" FOR[month] IN(jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec)" +
" )AS pvt";
SqlCommand cmd = new SqlCommand(CmdString, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable("Years");
dt.Dispose();
sda.Fill(dt);
dataGridViewYears.DataSource = dt.DefaultView;
dataGridViewYears.AutoResizeColumns();
con.Close();
chart1.Titles.Clear();
ChartArea chartArea1 = new ChartArea();
chartArea1.AxisX.MajorGrid.LineColor = Color.LightGray;
chartArea1.AxisY.MajorGrid.LineColor = Color.LightGray;
chartArea1.AxisX.LabelStyle.Font = new Font("Arial", 8);
chartArea1.AxisY.LabelStyle.Font = new Font("Arial", 8);
chart1.ChartAreas.Add(chartArea1);
chart1.Series.Add(new Series());
chart1.Series[0].XValueMember = dataGridViewYears.Columns[0].DataPropertyName;
chart1.Series[1].XValueMember = dataGridViewYears.Columns[0].DataPropertyName;
chart1.Series[0].YValueMembers = dataGridViewYears.Columns[2].DataPropertyName;
chart1.Series[1].YValueMembers = dataGridViewYears.Columns[3].DataPropertyName;
chart1.DataSource = dataGridViewYears.DataSource;
chart1.Series[0].Name = "Budget";
chart1.Series[1].Name = "Actual";
chart1.Series[0].Label ="#VALY";
chart1.Series[0].SmartLabelStyle.Enabled = true;
chart1.Series[1].Label = "#VALY";
chart1.Series[1].SmartLabelStyle.Enabled = true;
chart1.Size = new Size(1000, 450);
chart1.Titles.Add(Title);
chartArea1.Position.Height = 80;
}
}
}
|
|
|
|
|
So ... what is your question now ?
|
|
|
|
|
Hi Ralf
How do I show 3 series (for the years) and the 12 months on X and the value of each month on Y?
Data from datagridview - 3 rows
Thank you
|
|
|
|
|
You should be using the "data table" to create your chart series; not the "data grid".
Charting and "data grid viewing" are "parallel" operations on the same data source; one does not follow the other.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
In Visual C#, I made a user control, which contains several separate "individual" properties. But I would like to make it into one. In which there is a plus sign in font of my property where users could click on it and expand it and access its members. Just like the property Location, Size, or Font.
I tried packaging all those properties into one class and use the class as the property type, but then I have no idea how to get or set the values! And the property just return the whole class as the value! There is NO plus sign for anybody to click!
PLEASE help me out! Thank you very VERY much! God bless you!!!
|
|
|
|
|
|
|
|
Hi,
I have defined a combobox inside a DataTemplate.
I would like to access the selected item through the SelectedItemChanged event.
Problem: the comboBox seems to be not accessible from code behind.
Could someone tell me how to proceed?
RV
xaml:
<groupbox grid.row="1" grid.column="0" background="Transparent" margin="2,0,5,0">
<groupbox.header>
On going actions list view
<dockpanel grid.row="1" background="Transparent">
<datagrid name="dataGridActionsToPerform" autogeneratecolumns="False"
="" background="Transparent" borderbrush="Transparent">
<datagrid.resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
<Border Name="Border"
BorderThickness="0,0,0,1"
BorderBrush="Gainsboro"
CornerRadius="4,4,0,0"
Margin="2,0">
<TextBlock x:Name="ContentHeader"
Text="{TemplateBinding Content}"
Padding="5,5,5,0"
Width="{TemplateBinding Width}"
TextAlignment="Center">
</textblock>
</border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="Border"
Property="Background" Value="LightGray">
</setter>
</trigger>
</controltemplate.Triggers>
</controltemplate>
</setter.Value>
</setter>
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Border" SnapsToDevicePixels="true">
<GridViewRowPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding ColorProperty}" Value="Black">
<Setter Property="Background" Value="Blue"/>
</datatrigger>
<DataTrigger Binding="{Binding ColorProperty}" Value="Red">
<Setter Property="Background" Value="Red"/>
</datatrigger>
</style.Triggers>
<datagrid.columns>
<datagridtextcolumn header="Actions"
="" width="220" binding="{Binding ActionName}">
<datagridtemplatecolumn header="Control"
="" width="50">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<combobox name="ControlActionComboBox"
="" itemssource="{Binding CollectionOfPictures, Mode=TwoWay}" selectionchanged="controlAction_SelectionChanged" selecteditem="{Binding SelectedItem, Mode=TwoWay}">
<combobox.itemcontainerstyle>
<Setter Property="Padding" Value="5"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="1"/>
<combobox.itemtemplate>
<datatemplate>
<dockpanel>
RV
|
|
|
|
|
Your question is incongruent.
The simplest explanation is that the "code behind" you are "probably" looking for is wired to the following event handler:
SelectionChanged="controlAction_SelectionChanged"
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thank you Gerry for your reply,
Actually I had in mind to do a treatment, depending on the selected item. For that purpose, it is essential to determine which item was selected from controlActionComboBox.
But in the code behind I cannot address this comboBox through its name. That's the issue.
And I cannot figure out how to do what I have in mind.
Best regards,
RV
|
|
|
|
|
You can't wire up to an item in your DataTemplate directly. That's not the way that DataTemplates work. You'll need to do something like this[^] and then add the event handlers.
This space for rent
|
|
|
|
|
Thank you Pete for your reply,
I've finally got the solution to this issue through:
string text = (((sender as ComboBox).SelectedItem) as ActionPicture).ImageName
Where ActionPicture is the picture enclosed in the selected. And ImageName is the name of that picture.
Best regards,
Rv
|
|
|
|
|
Hi I need to refactor this code..thanks in advance for any help!!
public MyListViewModel GetData(List<UpdatingViewModel> updatingList, MyListViewModel myList)
{
foreach(UpdatingViewModel x in updatingList)
{
x.Gain = myList.UpdatingView[0].Gain;
x.Amount = myList.UpdatingView[0].Amount;
x.Minimum = myList.UpdatingView[0].Minimum;
x.Charge = myList.UpdatingView[0].Charge;
x.abc = myList.UpdatingView[0].abc;
}
}
|
|
|
|
|
Start by renaming the method. A method that updates something should not be called Get... !
Fix the compilation error. The method is declared as returning a MyListViewModel , but it doesn't return anything.
Then provide a proper description of what you're trying to do, what you've tried, and where you're stuck.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
How do you know when you've succeeded?
Is it: abc; Abc; ABC?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
add new tools to my tool box as *.dll file.
|
|
|
|
|
Simplest way?
Open the Design view on any form.
Open the Toolbox pane.
Close branches so you get "clear space".
Use Windows explorer to browse to the DLL or EXE file containing your controls.
Drag the Assembly file to the ToolBox and drop it there.
You can also create a new Tab first, and drop them on that if you want it a bit tidier.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Now, I am building an application like Russian dictionary. How to program the Russian pronunciation in C #, which library to use? Does the Speech or Speech.lib libraries contain "text to speech" functions for Russian as well as for English? Please Help me solve text russian to speech in C # using library or not?
modified 20-Dec-17 7:32am.
|
|
|
|
|
According to this[^], yes it does. BTW, remove your email address from your signature - that's a sure fire way to get spammed.
This space for rent
|
|
|
|
|
Thank you so much. Can you show me how to use the SDK? Currently I'm using C # 2012 but have not installed the SDK in C #? Please show me how to use it.
|
|
|
|
|
Google not working at your end?
|
|
|
|