|
OriginalGriff wrote: I've never had a problem with Anchoring or Docking - what exactly is happening to your derived form when you resize it?
The problem happens as soon as I derive a form from a base form. The derived form appears in the visual designer like this https://i.ibb.co/5sDNBRP/Untitled.png[^]
The derived form only shows the control box. I expand the form to its proper default size, and everything looks good. When I reopen that form in the designer, however, the controls are all jumbled and out of place. Curiously, if I compile and open the form during execution, it appears fine.
The blog I linked in my first post describes the problem and its causes. Thanks for the reality check. I'll upgrade my VS 2017 to the latest, and maybe it's time to move to WPF and drop WinForms. 
|
|
|
|
|
Have you tried expanding the size?
"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!
|
|
|
|
|
Yes, and when expanded, the form looks fine, but after saving and reopening, then the controls are jumbled and out of place. However, I'll have to figure out what I did different because now the form reopens just fine. Thanks for your suggestions.
Maybe it did solve the issue to use docked panels instead of putting the controls directly in the form. Is that a technique you use?
If you have a chance, give the articles I linked a look. They're interesting, and the writer seems to know his stuff.
|
|
|
|
|
Mostly, yes - though I generally create a UserControl if it's going to fill an area like a toolbar does, or provide a status bar. Those work fine docked to the top / bottom, then I'll use a central panel to drop other controls on.
"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!
|
|
|
|
|
|
It can get confusing sometimes - easy mistake to make!
"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!
|
|
|
|
|
Hello,
I already have a approved bot account on non english wikipedia. I am having trouble with converting the provided sample codes to C#. Would someone kindly do it? More details can be found at API:Tutorial - MediaWiki[^] and API:Edit - MediaWiki[^] Samples in java, PHP and python can be found at "API:Edit - MediaWiki" link. Here is sample code in java:
var request = require('request').defaults({jar: true}),
url = "https://test.wikipedia.org/w/api.php";
function getLoginToken() {
var params_0 = {
action: "query",
meta: "tokens",
type: "login",
format: "json"
};
request.get({ url: url, qs: params_0 }, function (error, res, body) {
if (error) {
return;
}
var data = JSON.parse(body);
loginRequest(data.query.tokens.logintoken);
});
}
function loginRequest(login_token) {
var params_1 = {
action: "login",
lgname: "bot_username",
lgpassword: "bot_password",
lgtoken: login_token,
format: "json"
};
request.post({ url: url, form: params_1 }, function (error, res, body) {
if (error) {
return;
}
getCsrfToken();
});
}
function getCsrfToken() {
var params_2 = {
action: "query",
meta: "tokens",
format: "json"
};
request.get({ url: url, qs: params_2 }, function(error, res, body) {
if (error) {
return;
}
var data = JSON.parse(body);
editRequest(data.query.tokens.csrftoken);
});
}
function editRequest(csrf_token) {
var params_3 = {
action: "edit",
title: "Project:Sandbox",
appendtext: "test edit",
token: csrf_token,
format: "json"
};
request.post({ url: url, form: params_3 }, function (error, res, body) {
if (error) {
return;
}
console.log(body);
});
}
getLoginToken();
Thanks a lot in advance.
modified 9-Feb-22 12:08pm.
|
|
|
|
|
Pallavi H Shinde wrote: Would someone kindly do it? Sure. As soon as we agree on payment.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I am doing it for free for wikipedia 
|
|
|
|
|
You're not doing it, you're asking me kindly to do it.
I do not do free work, as most here won't.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
I write in Postman this URL for Get method: https://localhost:7033/api/restaurant and I get 404 not found result. I don't know where is the problem. For https://localhostlocalhost:7033 it works, so it must be something wrong with [Route("api/restaurant")]
Here is the Controller code:
[Route("api/restaurant")]
public class RestaurantController : ControllerBase
{
private readonly RestaurantDbContext _dbContext;
public RestaurantController(RestaurantDbContext dbContext)
{
_dbContext = dbContext;
}
[HttpGet]
public ActionResult<ienumerable<restaurant>> GetAll()
{
var restaurants = _dbContext.Restaurants.ToList();
return Ok(restaurants);
}
}
and launchSettings file code:
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8196",
"sslPort": 44311
}
},
"profiles": {
"RestaurantApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7033;http://localhost:5033",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
modified 6-Feb-22 6:56am.
|
|
|
|
|
|
Hello,
when i set three '/' over my Property, i can declare a Comment for Intellisense.
Like this:
Now i have a special custom Attribute on this Proeprty.
I want to includ einformations of this Attribute into the Comment für Intellisense
Sample:
[MyCustomAttribute("ExtendedInformation")]
IPickingOrder Order { get; }
Now i see in intellisense the Text "Zugehöriger Auftrag" but i want to include the Attribute.
Anybody knows how to do that?
Best regard
Armin
|
|
|
|
|
If you're asking how you can automatically add the Attribute to part of the comment, you can't. You have to type it out yourself.
|
|
|
|
|
To add to what Dave has said, there is no way to get Intellisense to recognise your attributes as "Taggable" - the list cannot be customised, but "user defined" tags are allowed so there is nothing stopping you from typing it yourself (and it'll add the closing for you if you do).
The full list of "known tags" that intellisense will type for you is here: Documentation comments - C# language specification | Microsoft Docs[^]
"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!
|
|
|
|
|
If it's simply a matter of enhancing the documentation, this may help (when adding the attribute in the first place).
Documentation comments - C# language specification | Microsoft Docs
I add a comment if something needs commenting. If the attribute was important enough (without resorting to "find") I would have added it to the "Summary" in the first place. And what seemed important at the time, becomes the familiar.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Hello! Мaybe someone can help me how to write this project in Visual Studio with C#.Thanks
Menu: (Create menu in C# in console app.)
1. Send email to:
-to who
-text
1.1 Send email? Y / N
1.2 Exit program
2. Create FTP backup
-select local file (provide path)
-enter host
-enter port
-enter UserName
-enter PassW
If FTP finish with success - get email : FTP SUCCESS
Else - get email : FTP FAIL
Which file was successful at which datetime.
|
|
|
|
|
Dijana Deleva wrote: Мaybe someone can help me Certainly, but you need to show some effort first. No one is going to do you entire project for you.
|
|
|
|
|
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"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!
|
|
|
|
|
I'm very new to .Net Core so please bear with me!
I'm working on a project that uses EF Core as a data provider. I have managed to set things up so that any outstanding migrations are applied when the applicaton starts by doing the following:
Snippet from program.cs:
builder.Services.AddDbContext<MyDbContext>
(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddTransient<IStartupFilter, MigrationStartupFilter<MyDbContext>>();
MigrationStartUpFilter.cs:
using Microsoft.EntityFrameworkCore;
public class MigrationStartupFilter<TContext> : IStartupFilter where TContext : DbContext
{
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
{
return app =>
{
using (var scope = app.ApplicationServices.CreateScope())
{
foreach (var context in scope.ServiceProvider.GetServices<TContext>())
{
context.Database.SetCommandTimeout(160);
context.Database.Migrate();
}
}
next(app);
};
}
}
This works fine, using the connection string from appSettings.json.
However - I do not want the SQL account that is used for general data access to have DDL permissions, what I'd like to do is have a different user with the correct privileges that I use just for the migrations.
Is this possible?
|
|
|
|
|
Did you try to create a new/different (not a "DefaultConnection" one) connection string with "different user with the correct privileges" that you need?
|
|
|
|
|
Try setting the connection's ConnectionString property:
context.GetDbConnection().ConnectionString = "...";
context.Database.SetCommandTimeout(160);
context.Database.Migrate();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This is precisely what I'd like to do, but I don't want to hard code the connection string in the code, I want to get it from IConfiguration. But I'm unable to inject IConfiguration into my MigrationStartupFilter class because it has to implement IStartupFilter - so I can't add it as a parameter to the constructor for Configure. That's the crux of my issue.
|
|
|
|
|
Just worked it out, I can do
var cfg = scope.ServiceProvider.GetService<IConfiguration>();
to get the configuration service, and from there I can get my connection strings 
|
|
|
|
|