|
I knew somebody was going to ask that.
Because it was the minimum requirement to make the task async. But that task really doesn't need to be async since I'm getting information.
If it ain't broke don't fix it
|
|
|
|
|
How to Create a chart in PowerPoint using C#.Suppose i have the date in x axis and some arbitrary values in Y axis?
|
|
|
|
|
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search using your subject as the search term gave over half a million hits: How to Create a chart in PowerPoint using C# - Google Search[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi everybody,
i have created a user control combined with textbox and label.
i created text and label register to modify the label and textbox.
when i tried to bind the text and label nothing is shown.
here's the xaml of the user control:
<UserControl x:Class="Gestione_WPF.LabelledTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Gestione_WPF"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="200">
<Grid Background="White" FlowDirection="RightToLeft">
<Label x:Name="lbl" Content="{Binding Label, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Background="{StaticResource gradientBrushTabControlHeader}">
<Label.Style>
<Style TargetType="Label">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<StackPanel Orientation="Horizontal">
<Border Background="{StaticResource ResourceKey=gradientBrushSegmentedTabItem}" Width="200" BorderThickness="0,0,0,0">
<StackPanel Orientation="Horizontal">
<Viewbox StretchDirection="DownOnly" Stretch="Uniform">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True" TextBlock.FontSize="14" TextBlock.Foreground="#FFFFFF" Margin="5">
<ContentPresenter.Effect>
<DropShadowEffect BlurRadius="0.0"
Color="#032A6B"
Direction="90"
Opacity="1"
ShadowDepth="1" />
</ContentPresenter.Effect>
</ContentPresenter>
</Viewbox>
</StackPanel>
</Border>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Label.Style>
</Label>
<TextBox x:Name="txt" Text="{Binding Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="120" HorizontalAlignment="Right">
<TextBox.Style>
<Style TargetType="TextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border CornerRadius="0,0,0,50" BorderBrush="Black" Background="White" BorderThickness="0">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True" TextBlock.FontSize="14" TextBlock.Foreground="#FFFFFF" Margin="5">
<ContentPresenter.Effect>
<DropShadowEffect BlurRadius="0.0"
Color="#032A6B"
Direction="90"
Opacity="1"
ShadowDepth="1" />
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</UserControl>
here's the usercontrol.cs:
public partial class LabelledTextBox : UserControl
{
public LabelledTextBox()
{
InitializeComponent();
this.DataContext = this;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
}
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(LabelledTextBox), new PropertyMetadata(null));
public string Label
{
get { return (string)this.GetValue(LabelProperty); }
set { this.SetValue(LabelProperty, value);}
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(LabelledTextBox), new PropertyMetadata(null));
public string Text
{
get { return (string)this.GetValue(TextProperty); }
set { this.SetValue(TextProperty, value); }
}
}
and here's the implmentation:
<controls:LabelledTextBox Label="{Binding Hello}" Text="{Binding World}"/>
Why the binding not showing? if the label i'm doing without binding it works, but the text don't and i can't write inside the textbox.
|
|
|
|
|
So; you're saying you have properties called "Hello" and "World" somewhere?
Did you implement the INotifyPropertyChanged interface?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I did implement INotifyPropertyChanged but i finally solved my problem
i remove this.DataContext = this; from the user control
and added relative reference
to label content:
Content="{Binding Label, RelativeSource={RelativeSource AncestorType=UserControl}}"
and textbox text:
Text="{Binding Text,RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Hi there. I have following scenario
- one machine with a service installed (machine 1)
- one remote machine with public ip (machine 2)
- one machine with web application (machine 3)
All these machines could be in the same premises or in different. Since all of these machines and their respective software could be installed in any order, I don't know how to get machine 2's IP. Because my service on machine 1 will use this IP to upload data to it. And, of course, web application on machine 3 will display this data.
Any idea what API/library could I use on machine 1 to recieve machine 2's IP? Thanks for anything you share.
|
|
|
|
|
The user will have to enter it; there's no way that any api or library could "guess" which computer is meant with "machine 2".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Why don't you have machine 2 login to machine 1 and upload (i.e. FTP); instead of 1 calling 2, etc.
A scheduler on #2 and an event / file handler on #1 should suffice; based on your description.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
//Report Load page code using dataset
private void RPT_SupplierPer_Load(object sender, EventArgs e)
{
crystalReportViewer1.ReportSource = null;
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(cs.cstring());
con.Open();
SqlCommand cmd = new SqlCommand("RPT_Sup_All", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id",ID);
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new System.Data.DataSet();
//SupplierPer sp = new SupplierPer();
//da.Fill(ds);
// ds.Tables[0].TableName="RPT_Sup_All";
SupplierPer sp = new SupplierPer();
sp.Database.Tables[0].SetDataSource(ds.Tables[0]);
sp.SetDataSource(ds);
crystalReportViewer1.ReportSource = sp;
crystalReportViewer1.Refresh();
}
//print button code
private void btnPrint_Click(object sender, EventArgs e)
{
int id = Convert.ToInt16(txt_id.Text);
RPT_SupplierPer pt = new RPT_SupplierPer(id);
pt.Show();
}
|
|
|
|
|
You have already posted this in Question section.
modified 20-Sep-20 21:01pm.
|
|
|
|
|
My project would not run probably since i have 2 js file are crashing, but these 2 js files are important in my project and cant throw it. how can i solve this by other ways. TQ
|
|
|
|
|
And you want to use C# to solve the problem?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Downvote countered.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 13056303 wrote: how can i solve this by other ways. By debugging your application and working out what is causing these files to "crash" and then fixing those defects.
This space for rent
|
|
|
|
|
I have C# code, visual studio 2015 for desktop data entry application. I have 9 columns in datagridview. I need only 5 columns for pdf. One of 5 columns will blank. Please sample code or example.
|
|
|
|
|
Member 13023028 wrote: I have C# code, ... Please sample code or example. Which one should we follow? Typically, such complex data structures are never shared on an online "sample" code, and this defines your business logic and should be developed by you.
You can start something off, and then let us help you, but we do not provide free codes. For a beginner's code or article, please search on the top right corner.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Collapse / hide the unwanted columns.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I already have very large amount of code . Now I want to integrate one more functionality for this code for which i have to execute some code before and after every function call .How can i do this effectively.
|
|
|
|
|
This is a complicated topic, and one you really should have designed for before you reached this point. Normally, you would apply something called Aspect Oriented Programming (AOP) to allow you to automatically add code to your application at specified points. This gives you fine grained control of what you want to do. As you haven't designed your application for this, you're probably going to have to fall back to a technique called IL weaving - this means that you are going to weave in IL code to your application (it's what most AOP systems do, but they give you control over the process - you're going to end up having to manually do this yourself).
You will probably find this[^] article to be some help in getting started.
This space for rent
|
|
|
|
|
|
In addition to the CP article that Pete cited, also see: [^], [^].
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal
|
|
|
|
|
Thank you very much BillWoodruff .Can you please tell em how to pass our own custom attributes .
|
|
|
|
|
Question: what is the scale/scope of the code base you wish to monitor/log ? Multi-threading involved ? Team project with multiple code repositories ?
Also see this recent article: [^].yeswanthkumar wrote: Can you please tell em how to pass our own custom attributes While I am a registered owner of PostSharp, I do not have the expertise to comment on any other method/tool, and I have never tried to explore creating custom attributes in PostSharp: however their documentation/support are very good, and I expect if the need arose, it could be done: [^].
imho, the task of IL-weaving/AOP is an extremely technically deep subject, and experimenting with "rolling your own" potentially risky in terms of technical "cost."
Have you looked at Spring.NET: [^] ?
cheers, Bill
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal
|
|
|
|
|
OK, here's a real mind-twister. I can't figure out how to declare the parameter of a function as deriving from a generic class.
Here's the code:
public class BusinessObjectBase
{
}
public class BusinessObjectList<T> : List<T> where T : BusinessObjectBase
{}
public class BusinessObjectDataSet : DataSet
{
protected BusinessObjectList<BusinessObjectBase>[] _BusinessObjectListArray = null;
public virtual void AddBusinessObjectList(BusinessObjectList<BusinessObjectBase> List)
{
}
}
I want to specify the variable as type BusinessObjectList<T> where T derives from BusinessObjectBase.
The code above compiles fine, but when I go to use the classes, that's the problem:
private class MyBusinessObject : BusinessObjectBase
{
public MyBusinessObject()
{
}
}
private class MyBusinessObjectList<MyBusinessObject> : BusinessObjectList<T> where T : BusinessObjectBase
{
}
BusinessObjectDataSet Set = new BusinessObjectDataSet();
MyBusinessObject Bo = new MyBusinessObject();
MyBusinessObjectList<MyBusinessObject> BoList = new MyBusinessObjectList<MyBusinessObject>();
Set.AddBusinessObjectList(BoList);
What am I doing wrong?
Thank you for taking the time to grok this.
EDIT: Fixed an omission in the code. Revised the question that I'm asking.
The difficult we do right away...
...the impossible takes slightly longer.
modified 29-May-17 16:14pm.
|
|
|
|