|
It's an easy mistake to make. Glad you got it sorted.
This space for rent
|
|
|
|
|
Hi All,
Please suggest how can we print multiple files in one go. I am getting all files from a folder and the files are in different formats(pdf,jpg,bmp,msg,word,text).
Please suggest how can we do this in C#(web Forms).
Thanks in Advance
Regards
Binod
|
|
|
|
|
It rather depends on whether the files are in a printable form already. If yes, then you can just send them direct to the printer. If no, then you will need to read the content and reformat it first. See Print spooler[^] for information which may be useful.
|
|
|
|
|
Web applications don't get much control of print queues. This means that web printing is in the control of the browser so if you want to print all these together, you are going to have to combine them all into one source that can then be printed out. I would suggest combining them into a PDF.
This space for rent
|
|
|
|
|
I have created groups example,supplierName and Date .I have store each supplier amount in one field .I want this each supplier amount sum in grand total...I have join Two table in databse.no of product are display...
|
|
|
|
|
Can we reuse the Visual Studio Unit Test in other unit test ?
|
|
|
|
|
I'm writing a C# WPF application that contains two stacked StackPanels. When the user clicks on Panel1 it's height value changes expanding the space between Panel1 and Panel2. When the user clicks on Panel2 it's height is expanded and Panel1's height is set back to it's original value. I am able to get this working in the xaml code:
<pre> <StackPanel Margin="1,1,1,1" Grid.ColumnSpan="3">
<StackPanel Name="Panel1" Height="26">
<Label HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="Menu_1" Foreground="White" FontWeight="Bold" MouseLeftButtonUp="Panel1_MouseLeftButtonUp">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF80CEF3" Offset="0.01"/>
<GradientStop Color="#FF5588A0" Offset="1"/>
</LinearGradientBrush>
</Label.Background>
</Label>
<StackPanel.Triggers>
<EventTrigger RoutedEvent="UIElement.MouseLeftButtonUp">
<BeginStoryboard >
<Storyboard x:Name="Animation1">
<DoubleAnimation Storyboard.TargetName="Panel1" Storyboard.TargetProperty="Height" To="646" Duration="0:0:0.50" AccelerationRatio="0.6" DecelerationRatio="0.4" />
<DoubleAnimation Storyboard.TargetName="Panel2" Storyboard.TargetProperty="Height" To="26" Duration="0:0:0.50" AccelerationRatio="0.6" DecelerationRatio="0.4" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</StackPanel.Triggers>
</StackPanel>
<StackPanel Name="Panel2" Height="26">
<Label HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="Menu_2" Foreground="White" FontWeight="Bold">
<Label.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF80CEF3" Offset="0.01"/>
<GradientStop Color="#FF5588A0" Offset="1"/>
</LinearGradientBrush>
</Label.Background>
</Label>
<StackPanel.Triggers>
<EventTrigger RoutedEvent="UIElement.MouseLeftButtonUp">
<BeginStoryboard>
<Storyboard x:Name="menu">
<DoubleAnimation x:Name="Menu_1" Storyboard.TargetName="Panel1" Storyboard.TargetProperty="Height" To="26" Duration="0:0:0.50" AccelerationRatio="0.6" DecelerationRatio="0.4" />
<DoubleAnimation x:Name="Menu_2" Storyboard.TargetName="Panel2" Storyboard.TargetProperty="Height" To="646" Duration="0:0:0.50" AccelerationRatio="0.6" DecelerationRatio="0.4" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</StackPanel.Triggers>
</StackPanel>
</StackPanel>
However, I'm trying to do the same thing programmatically, so that I can determine at runtime what the new height should be when the user clicks on a panel. I implemented the following EventHandler, but it doesn't work (the Panel heights do not change).
private void Panel1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
DoubleAnimation oMenuAnimation = new DoubleAnimation();
oMenuAnimation.From = 26;
oMenuAnimation.To =646;
oMenuAnimation.Duration = new Duration(new TimeSpan(0, 0, 0, 500));
oMenuAnimation.AccelerationRatio = .6;
oMenuAnimation.DecelerationRatio = .4;
Storyboard s = new Storyboard();
Storyboard.SetTargetProperty(oMenuAnimation, new PropertyPath("Height"));
Storyboard.SetTarget(oMenuAnimation,Panel1);
Storyboard.SetTargetName(oMenuAnimation, "Panel1");
s.Children.Add(oMenuAnimation);
DoubleAnimation oMenuAnimation2 = new DoubleAnimation();
oMenuAnimation2.To = 26;
oMenuAnimation2.Duration = new Duration(new TimeSpan(0, 0, 0, 500));
oMenuAnimation2.AccelerationRatio = .6;
oMenuAnimation2.DecelerationRatio = .4;
Storyboard.SetTargetProperty(oMenuAnimation2, new PropertyPath("Height"));
Storyboard.SetTarget(oMenuAnimation2, Panel2);
s.Children.Add(oMenuAnimation2);
s.Begin();
}
Does anyone know what I may be doing wrong?
|
|
|
|
|
Hi girls and guys.
I`m trying to simulate clicks on toolbar entrys and checkboxes on a third party application.
"Pls don`t schold with me.. I`m at the beginning of my c# carrer "
Atm. I was trying it on notepad++. I was able to start the process, and send a message with SendMessage. I got the needed informations through Spy++/WindowDetective.
Process p = Process.Start(@"C:\Program Files (x86)\Notepad++\notepad++.exe");
p.WaitForInputIdle();
IntPtr h = p.MainWindowHandle;
SetForegroundWindow(h);
IntPtr child = FindWindowEx(h, new IntPtr(0), "Scintilla", null);
SendMessageW(child, 0x000C, 0, "Test \n test2");
I understood that with SendMessage I have to find first the needed class where i want to do something and use the right parameters to do the wanted imputs like mouseklick and keypresses. I was able to find them on mouse_event function (Windows)[^]. But about the WParam and LParam am I still confused cause it depends which imput i am using what I have to put on WParam and LParam. Maybe someone can explain it for a noob...
Now my problem is, i want to try some mouseklicks on the toolbar in the "Settings" ContextMenu. But I can not find it with Spy++ or other tools. It is not possible to do a click on it by the "Visual" Name like in AutoIT?
I have another tool where I have some checkboxes and I want to check it if its checked or not but there I can not get any class too. How could I solve it?
I found a nice Tool from Visual Studio (CUIT) but its only in the Enterprise-Version available.
Ty for your time.
Edit: Does no one have a clue?
modified 27-Jun-17 10:32am.
|
|
|
|
|
Greetings all!
I'm interested in learning C# now, and excited to hear that Microsoft has released a library that makes Mono no longer a requirement, for it to run under Linux and MacOS X.
This being said, would I need to use a tool native to each OS to design the GUI?
thanks for the feedback in advance!
Chris
|
|
|
|
|
The library that you are talking about is called, .NET Core, and it does not support a cross-platform GUI, it would support a UI for Windows only, and rest of the systems do not support that at the moment.
If you want to learn cross-platform development with C#, stick to .NET Core and only build native applications, that run on terminals. Since graphics are not supported, officially. There are several other frameworks that you can use for graphics, but remember, they would require other dependencies and would come with their own learning slopes.
If you still do want to learn GUI, then yes, you need something like that.
Read a few of the following threads and discussions going on under this .NET Core thing,
Cross Platform GUI - .NET Foundation Forums
c# - How can I develop cross-platform gui application using .Net Core - Stack Overflow
coreclr - Is it possible to make desktop GUI application in .NET core? - Stack Overflow
Cross-Platform Graphics in .NET Core – Cameron Aavik – Medium
But who knows, maybe in the next versions we might get some GUI cross-platform, or one of the best tools (WPF, for instance), gets open sourced. At the moment, .NET Core 2 is the latest. core/2.0.0-preview1.md at master · dotnet/core · GitHub
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Member 13275688 wrote: This being said, would I need to use a tool native to each OS to design the GUI? First you'd need to decide which UI; you could use WinForms on both platforms, GTK or support both.
I've used Visual Studio to create WinForms to be used with Mono. The WinForm implementation differs a tiny bit from the MS implementation, so you will have to test the results.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm trying to add a context menu to Watch (and Local) window to Visual Studio (2017). I was able to add the context menu, however I don't know how to obtain the selected item (expression) from the context menu command code.
Thanks Abyss
|
|
|
|
|
Hi,
I have a Console Application which is Scheduled as Scheduled Task, for some reason maybe because of the NetWork issues the Scheduled task is showing running unlimited time and not processing any files or records which are over the network.
Now I want find out in my Console Application if the Task is running and waiting for more than 1 hr send us an Email, can anybody please let me know which approach is better for this, like do we have something in the Windows Scheduler Task to set this setting? Or can I write some code in my Console App to check how long the Task is working for and send an Email or stop it if its too late.
Thanks in advance, any help can be greatly appreciated.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Sounds like a good fit for a watchdog-application; how about simply getting a list of the running tasks and the CPU-utilization? If you notice any application hogging a CPU, you mail.
Doesn't protect you just against your application from going nuts, but other processes as well. Doesn't need a UI, nor much code
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If you don't mind can you please provide me a small code snippet or links for it?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
how to remove Flag status from Outlook by c# programming or register edit
|
|
|
|
|
|
That is done as described on MSDN.
You're welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am not getting proper solution. Please give me proper answer.
|
|
|
|
|
As a programmer, one of the best skills you can learn is how to use Google effectively. If you look at the search terms I use here[^] , you can see how easy it is for you to find the answer you want (look at the top answer to get started).
This space for rent
|
|
|
|
|
Hello community,
I'm refactoring a C# application and found 7 (!) methods which do quite the same thing to different parameters. These parameters are LINQ-results.
private void Doit_T(IEnumerable<string> T) {...}
private void Doit_R(IEnumerable<int> R) {...}
private void Doit_C(IEnumerable<int> C) {...}
private void Doit_TR(IEnumerable<string,int> TR) {...}
private void Doit_TC(IEnumerable<string,int> TC) {...}
private void Doit_RC(IEnumerable<int,int> RC) {...}
private void Doit_None() {...}
This sounds like a case for overloading. It would reduce the 7 methods to 5, as there are 5 distinct combinations of parameter types:
private void Doit(IEnumerable<string> T) {...}
private void Doit(IEnumerable<int> R_or_C) {...}
private void Doit(IEnumerable<string,int> TR_or_TC) {...}
private void Doit(IEnumerable<int,int> R_and_C) {...}
private void Doit() {...}
Better than before. But can it get shorter?
As the logics within these methods are quite, but not totally identical, I'd like to unify these methods to just one which "senses" the 7 cases (or gets them passed via a string like "RC" or "T"). The catch is the number and type of arguments of this unified method:
0, 1 or 2 arguments --> optional arguments via default values needed.
different IEnumerable-types --> Generic Approach using IEnumerable<t>.
I lack experience on combining those two needs. What could a "unified" method signature look like?
Thanks
Atrus
modified 21-Jun-17 2:34am.
|
|
|
|
|
atrus2711 wrote: IEnumerable<string,int>
There is no IEnumerable<T1, T2> interface in the framework. Did you mean IEnumerable<KeyValuePair<TKey, TValue>> ?
atrus2711 wrote: What could a "unified" method signature look like?
Without knowing what the methods are doing, that's almost impossible to answer. The obvious suggestion would be:
private void Doit<T>(IEnumerable<T> values) { ... }
That may or may not work, depending on the differences between the methods, and what you mean by IEnumerable<T1, T2> .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
my fault, my explanation was too compressed...
Take this excerpt of method Doit_R. It isolates the distinct values of a single column:
var result = SomeList.Select(c => c.IntegerField).Distinct();
Here, result is an IEnumerable<int>.
Doit_RC gathers distinct values of two columns, both ints:
var result = SomeList.Select(c => new { c.IntegerField1, c.IntegerField2}).Distinct();
Here, result is an IEnumerable of an anonymous type, consisting of two ints.
Doit_TR gathers distinct values of two columns, a string and an int:
var result = SomeList.Select(c => new { c.StringField, c.IntegerField}).Distinct();
Here, result is an IEnumerable of an anonymous type, consisting of a string and an int.
A unified method should be able to deal with all of these IEnumerables.
How could this be done?
Thanks
|
|
|
|
|
Something like this?
private void DoIt<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, TResult> selector, IEqualityComparer<TResult> comparer = null)
{
...
var result = source.Select(selector).Distinct(comparer);
...
}
DoIt(SomeList, c => c.IntegerField);
DoIt(SomeList, c => new { c.IntegerField1, c.IntegerField2 });
DoIt(SomeList, c => new { c.StringField, c.IntegerField });
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|