|
You have to have Microsoft Excel, or Office, installed on the machine. Interop doesn't mean you get the functionality without the app. It means it's an "interoperability" interface between your app and the app you're trying to use in it, like Excel.
|
|
|
|
|
|
Try reinstalling Excel on the problem machine.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
We just change netcore to framework and it works
Hello,
We have a WS, if you go to server you can run it and see the 2 methods, you can invoke then and WORK
If you go to Visual Studio 2019 and add a reference to the project using the: http://xxx.xxx.xxx.x/wsxxx/wseps.asmx?wsdl you can see the method and add to the project:
But when we try:
ServiceReference1.WPSSOAPCLIENT oClient= new ServiceReference1.WPSSOAPCLIENT()...
1. The new ServiceReference1.WPSSOAPCLIENT() is marked as an error.: Does not contanins a constructor that take 0 argument
modified 24-Aug-21 10:16am.
|
|
|
|
|
So take a look at the new constructor. The error is really self explanatory, so follow the instructions and see what constructors are available now.
|
|
|
|
|
I have such a clicker, I want to be able to continue, for example, after opening another application, or vice versa. Please help
All code here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Klikacz____TzPw
{
public partial class Form1 : Form
{
[DllImport(dllName: "User32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
private const int LEFTUP = 0x0004;
private const int LEFTDOWN = 0x0002;
public Form1()
{
InitializeComponent();
this.ActiveControl = button1;
button1.Focus();
}
private void Click_clock_Tick(object sender, EventArgs e)
{
Random rnd = new Random();
int maxcps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 * 0.2));
int mincps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 * 0.4));
try
{
Click_clock.Interval = rnd.Next(mincps, maxcps);
}
catch
{
}
bool mousdown = MouseButtons == MouseButtons.Left;
if (mousdown)
{
mouse_event(dwFlags: LEFTUP, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
Thread.Sleep(millisecondsTimeout: rnd.Next(1, 6));
mouse_event(dwFlags: LEFTDOWN, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
}
}
private void button1_Click(object sender, EventArgs e)
{
if (button1.Text.Contains("Uruchom"))
{
Click_clock.Start();
button1.Text = "Wstrzymaj";
}
else
{
Click_clock.Stop();
button1.Text = "Uruchom";
}
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
CPSValue.Text = "CPS = " + trackBar1.Value.ToString();
}
}
}
|
|
|
|
|
1) you can keep things in your app running, whether or not your app is the current active application, by using a Timer, or having a some form of 'while loop. advice : don't use a 'while loop.
2) when your app is not active ... it can still get messages by using a GlobalKeyBoardHook it defines, and registers, that intercepts some keyboard combination of keys. warning: you override some other app's keyboard hooks, and you are in trouble.
I believe what you probably need to use is the SystemTray app model, and CP has several articles that will show you how to use that: [^]
However, if what you want is some kind of stealth monitoring app: you won't get help with that here.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Just had one of those moments where I thought I was going mad. I had put a method implementation in an interface (not quite sure how I got there) and not only did the compiler not complain, it actually worked. After several minutes questioning my sanity, I recalled something new in the language about this, and it turns out its C#8 'default implementations' or some such.
Thus the central tenet of an interface 'can't contain an implementation' is gone, well sort of. I think its probably the case that the source can contain an implementation, but its just lifted into the implementer by the compiler, which I guess creates a type of static polymorphism. Haven't actually read about it too closely so that might be wrong. There certainly seems to be parallels to a virtual function. I really feel I need to sit down and think out my understanding and implications of all this now.
It warrants the question whether they are messing with the language too much? As it turns out this feature is of use to me if I don't think about it too much, allowing me to provide a simple helper property which just combines other properties, but it seems an interface is just that bit closer to an abstract class now.
I have to say these updates to the language generally aren't met with pleasure by me. They're just more things I feel I need to keep on top on rather than things that actually make my life easier. Old dog maybe, I still haven't got over extension methods yet!
Regards,
Rob Philpott.
|
|
|
|
|
Yes, default interface methods look like a complete mess to me:
Interfaces can now include static members, including fields and methods. Different access modifiers are also enabled. The additional fields are private, the new method is public. Any of the modifiers are allowed on interface members.
Thankfully, it's restricted to .NET Core 3.0 or later. With no SSRS support in .NET Core / .NET 5, we're sticking with .NET Framework 4.8, so our interfaces shall remain untainted by this abomination.
If you're interested, Matt Warren digs into the low-level "behind the scenes" details here:
Under the hood of "Default Interface Methods" · Performance is a Feature![^]
Oh, and things are set to get even worse in C# 10:
[Proposal]: Static abstract members in interfaces · Issue #4436 · dotnet/csharplang · GitHub[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
static members as well?? Well, at this point that makes entirely zero sense to me. Oh, the horror..
Regards,
Rob Philpott.
|
|
|
|
|
God what a dogs breakfast
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Interfaces are somewhat lame, but needed; extensions work here and there; inheritance is "bad". I think it provides some middle ground.
If it avoids having to implement every interface member, all the time, that's good too.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
using Framework 4.8, WinForms (classic).
I'm doing some complex run-time stuff with a TableLayoutPanel in a UserControl ... adding, replacing Controls, resizing columns, changing ColumnSpans ... even though the UserControl is double buffered, as well as its hosting Form (site) ... the usual bracketing in Suspend/Restore-Layout blocks does not prevent cascades of spastic stuttering.
But, one little dose of good old CreateParams
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle = cp.ExStyle | 0x2000000;
return cp;
}
} I thought that had gone extinct with other VB-heritage dinosaurs like 'DoEvents.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
modified 18-Aug-21 2:05am.
|
|
|
|
|
Yeah, I've had to use it occasionally as well: Disable the Close box on a form[^]
But ... at least MS provided a nice, easy way to do something they didn't think you'd ever want to!
If they hadn't ... it would have been a real PITA.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: MS provided a nice, easy way to do something they didn't think you'd ever want to! As opposed to the method they've provided in Weleven for changing your default web browser.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi,
I don't remember what the state/quirks of WinForms was in 2012, when you wrote that tip, but, it is possible to toggle the visibility of the ControlBox at run-time by setting its boolean value.
Of course, yes, hide the ControlBox, and the max/min buttons and the icon/menu, vanish.
However, I'd find it quite strange to have those control widgets disappearing, reappearing
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
database db = new database(); DataTable tbl = new DataTable();
private void AutoNumber()
{
tbl.Clear();
tbl = db.readData("Select max (Des_ID) from Deserved", "");
if ((tbl.Rows[0][0].ToString() == DBNull.Value.ToString()))
{
txtID.Text = "1";
}
else
{
txtID.Text = (Convert.ToInt32(tbl.Rows[0][0]) + 1).ToString();
}
NudPrice.Value = 1;
DtbDate.Text = DateTime.Now.ToShortDateString();
txtNotes.Clear();
btnAdd.Enabled = true;
btnNew.Enabled = true;
btnDelete.Enabled = false;
btnDeleteAll.Enabled = false;
btnSave.Enabled = false;
|
|
|
|
|
|
The error says that there are either no rows or no columns in your Rows collection:
And why that might be is not something we can help with: we have no access to your database class, or its readData method, or the data behind it.
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
But you do have to ask yourself why you are going at this in such as "round the houses" approach: creating and filling a DataTable for a single numeric value looks rather silly, when every SQL based system I have ever met has supported an ExecuteScalar method to query and return a single value ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi,
I want to detect index of all empty values in a list using Linq. I searched StachOverFlow to find a solution. I changed it based on my needs. The following Linq method syntex works fine:
List<string> collection = new List<string>() {"", "ghjg", "jkgh", ""};
var indexOf = collection.Select((value, index) => new { value, index })
.Where(pair => string.IsNullOrEmpty(pair.value))
.Select(pair => pair.index);
foreach (var item in indexOf)
{
Console.WriteLine(item);
}
I tested it in LinqPad.
But I need an explanation about how Linq detects index in the defined pair?
|
|
|
|
|
|
Hello.
I use C# in Visual Studio and need to work with Excels spreadsheets. I know how to create and save the spreadsheets, but I need to format the plan, like to define the cell color, a collumn width and so on. Can anyone tell me how to access the commands in Excel through C#?
Thanks.
|
|
|
|
|
|
|
You can use the Range[^] class to refer to rows, columns and cells. You can add formatting, formulas etc through these objects. I have a sample application that contains the following sequence to control a range of cells:
cellRange = worksheet.get_Range("D2", "D6");
cellRange.Formula = "=RAND()*100000";
cellRange.NumberFormat = "£#,##0.00";
There are a number of websites run by Excel experts that offer help which Google can find for you.
|
|
|
|
|