|
I think that is the likely cause since the base form is in a different assembly. It would make sense that VS is trying to make sure the image is still available to the child forms in a different assembly by copying the resource into the resx file. I'll try moving the base form into the same assembly to see if it resolves the issue. Thanks.
|
|
|
|
|
Hello all. I am asking this for my wikipedia editing. I am not from the background of computer science but I edit wikipedia a lot.
I am using a software called as auto wiki browser to edit: brief intro to AWB - Wikipedia[^] AWB is a very powerful tool. It also supports modules.Wikipedia:AutoWikiBrowser/Custom Modules - Wikipedia[^] also regex.
I am running a find and replace task using awb. I wants to add some rules for skipping.
My exact problem in short: on wikipedia there are many pages called as disambiguation page for example: Robert Abel - Wikipedia[^]
This Robert Abel page lists all the persons named Robert Abel and nothing else. Ideally no wiki page should link to Robert Abel. The pages should link to particular Roberts. For example Robert Abel (animator)[^] or Robert Abel (footballer).
What I wants to do is: AWB makes a list of all the pages linking to Robert Abel (base page). I wants to search for Robert Abel and replace it with Robert Abel (animator). But if the text is "Robert Abel (footballer)" or "Robert Abel (racing driver)" then I wants to skip it.
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = false;
Summary = "fix wikilink";
ArticleText = ArticleText.Replace("Robert Abel", "Robert Abel (animator)");
return ArticleText;
}
I tried the above code in AWB module. But if there is already "Robert Abel (animator)" in the article then it addings "Robert Abel (animator) (animator)". I tried to add else parameter but it giving compilation error. This is faulty code:
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = false;
Summary = "fix wikilink";
ArticleText = ArticleText.Replace("Robert Abel", "Robert Abel (animator)");
if ArticleText = "Robert Abel (animator)" {
Skip = true;
} else {
ArticleText.Replace("Robert Abel", "Robert Abel (animator)");
}
return ArticleText;
}
Update edit: I thinks it is giving error because of the bracket of (animator) after else. idk.
I wants to add few different rules. example: skip if "A" or "B" or "C" is present. If "D" is present then change it to "E". If "F" is present then change it to "G". If I can get one example then I can do the rest with monkey sees monkey does principle.
The problem comes with text after "Robert Abel". How to tell the program to not to make any changes/skip that one particular instance when there is "Robert Abel (animator)" or "Robert Abel (footballer)", and then to look for next instance of only "Robert Abel"?
Please help me. But I am not from background of computer science so please explain in way that I will understand. I also asked the same question on this same website: How to perform find and replace with condition in C# and/or regex?[^]
modified 26-Aug-20 14:21pm.
|
|
|
|
|
This is teh same question you asked yesterday: How to perform find and replace with condition in C# and/or regex?[^] - the answer you have has not changed in that time ...
"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 OriginalGriff. I pointed out in the bottom that I already asked the question, with a link. I posts here, because I thinks this is the correct venue. Please help if you can.
|
|
|
|
|
Hi,
I just wanted to point out that the wikipedia disambiguation bot already exists[^]. I highly doubt another bot that does the same thing will gain WP:BOTAPPROVAL consensus.
|
|
|
|
|
Hi. Thanks for the reply. I am not a programmer and I can not create bot. I only wants to do find and replace with multiple terms.
|
|
|
|
|
Since an article can contain multiple "Abels", you have to index through the text and update any Abel that doesn't end with " (".
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
|
|
|
|
|
Gerry Schmitz wrote: you have to index through the text and update any Abel that doesn't end with " (".
Hi. Thanks for the reply. But how do I do that?
|
|
|
|
|
string text = "...Robert Abel....Robert Abel (pilot)....Robert Abel";
text += " ";
string oldValue = "Robert Abel";
string addedValue = " (animator)";
int startIndex = 0;
while ( true ) {
int i = text.IndexOf( oldValue, startIndex );
if ( i < 0 ) { break; }
string x = text.Substring( i, oldValue.Length + 2 );
startIndex = i + oldValue.Length;
if ( !x.EndsWith( " (" ) ) {
text = text.Insert( startIndex, addedValue );
}
}
Console.WriteLine( text.TrimEnd() );
Console.ReadKey();
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
|
|
|
|
|
I made a bank management system which basically adds deletes edits and saves the data of certain departments inside the bank such as the accounting department or the administration or HR. How do I get a pdf and an excel datasheet of the data I added and the like a report of the number of employees total salary etc.
|
|
|
|
|
What have you tried?
Where are you stuck?
What help do you need?
There are so many different way this is possible, that you need to be specific about what you have available and what you have done so far.
Unless this is homework and you want someone to do it for you?
"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!
|
|
|
|
|
Good call. You would think that someone who made a bank management system would have a clue.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
ETL: extract, translate, load.
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
|
|
|
|
|
Nice topic
How are you expecting an answer without giving a specification on what you are using and how? there are almost unlimited ways to build what you are building, as a programmer you should be able to understand that and help the others help you
|
|
|
|
|
There are many books on C# these days but a lot of them are aimed at console programming and there is little if any information about Windows desktop form programming.
Can someone please recommend a book that will give me more understanding on how to write Windows desktop form type programs (programs with buttons, textboxes etc).
Brian
|
|
|
|
|
|
Thanks Richard, but I've tried searching using Google with not much luck.
I was hoping that if someone who owns a book, on the subject I'm seeking then prehaps they could recommend the book to me.
There are some internet sites that display creating a form but many just show you how to place objects on the form, I'd like to know more about the code. Others just give you bits of the code and not the entire code.
I'm also seeking example code for forms.
Brian
|
|
|
|
|
It is very difficult to make specific recommendations as their usefulness depends very much on the reader's experience and ability. The first C# book i ever worked on was .NET Book Zero by Charles Petzold[^] which is all console based, but gives an excellent grounding in the actual C# language. From there I read various CodeProject and other articles to get an idea of how to use Windows Forms. But the problem is that it is a huge subject and it is not something you can learn in a few days (despite the claims from some websites). Go and explore some of the links in the two Google searches I gave you and see which sites, books etc., you find useful.
|
|
|
|
|
Brian_TheLion wrote: a lot of them are aimed at console programming
No, most "beginner" books start with the console because it's really easy to get immediate feedback for beginners - they don't have to worry about the complexities involved in setting up a website, or creating a form and getting input and output controls onto it; the beginner can focus on learning the real basics of development.
They move to websites, WinForms, WPF, later when the learner is familiar with variables, flow control, collections, and so forth.
Think about it: which is easier for a beginner to create:
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
} Or
using System;
using System.Windows.Forms;
namespace HelloWorldForms
{
public partial class FrmMain : Form
{
#region Constants
#endregion
#region Fields
#region Internal
#endregion
#region Property bases
#endregion
#endregion
#region Properties
#endregion
#region Regular Expressions
#endregion
#region Enums
#endregion
#region Constructors
public FrmMain() => InitializeComponent();
#endregion
#region Events
#region Event Constructors
#endregion
#region Event Handlers
#region Form
private void FrmMain_Load(object sender, EventArgs e)
{
if ((ModifierKeys & Keys.Shift) == 0)
{
this.LoadLocation();
}
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if ((ModifierKeys & Keys.Shift) == 0)
{
this.SaveLocation();
}
}
private void FrmMain_Shown(object sender, EventArgs e)
{
}
#endregion
private void butPressMe_Click(object sender, EventArgs e)
{
labBanner.Text = "Hello World!";
}
#endregion
#endregion
#region Threads
#endregion
#region Public Methods
#endregion
#region Overrides
#endregion
#region Private Methods
#endregion
}
} Together with:
namespace HelloWorldForms
{
partial class FrmMain
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.labBanner = new System.Windows.Forms.Label();
this.butPressMe = new System.Windows.Forms.Button();
this.SuspendLayout();
this.labBanner.Location = new System.Drawing.Point(13, 113);
this.labBanner.Name = "labBanner";
this.labBanner.Size = new System.Drawing.Size(259, 23);
this.labBanner.TabIndex = 0;
this.labBanner.Text = "Press the button!";
this.labBanner.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.butPressMe.Location = new System.Drawing.Point(12, 158);
this.butPressMe.Name = "butPressMe";
this.butPressMe.Size = new System.Drawing.Size(260, 23);
this.butPressMe.TabIndex = 1;
this.butPressMe.Text = "Press here!";
this.butPressMe.UseVisualStyleBackColor = true;
this.butPressMe.Click += new System.EventHandler(this.butPressMe_Click);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Controls.Add(this.butPressMe);
this.Controls.Add(this.labBanner);
this.Name = "FrmMain";
this.Text = "One off jobs";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
this.Load += new System.EventHandler(this.FrmMain_Load);
this.Shown += new System.EventHandler(this.FrmMain_Shown);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label labBanner;
private System.Windows.Forms.Button butPressMe;
}
}
"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!
|
|
|
|
|
Well... I have been teaching programming novices to put a "Hello World" message box on the screen in a small fraction of all that red tape.
I see the point you want to make, and you make it with true grandeur. But that is the only alternative.
|
|
|
|
|
You can do, yes - because VS with link all the stuff up for you and throw in a pile of code ready to rock and roll.
But ... it looks like a lot of code to a beginner (because it is) and it's remarkably easy to break it and have no idea where or how to fix it!
"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!
|
|
|
|
|
Any development environment do things for you. When I went from Pascal to C, ages ago, I was puzzled by the compiler automatically doing the linking for me. It throws in all sorts of library functions as well. In principle, there is little difference to modern IDEs.
I made a minimal GUI Hello World - not quite a one-liner, but not that far away:
using System.Windows;
namespace Hello {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
public void Terminate(object sender, RoutedEventArgs evtArg) {
Application.Current.Shutdown();
}
}
} Note that all I had to write myself was
public void Terminate(object sender, RoutedEventArgs evtArg) {
Application.Current.Shutdown();
}
- the rest was generated for me. Then comes the GUI elements:
<Window x:Class="Hello.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Hello" Height="100" Width="120">
<StackPanel HorizontalAlignment="Left">
<TextBlock x:Name="textBlock" Text="Hello World"/>
<Button x:Name="button" Content="OK" Click="Terminate"/>
</StackPanel>
</Window> - again, a of it lot generated. All I had to write myself was:
<StackPanel HorizontalAlignment="Left">
<TextBlock x:Name="textBlock" Text="Hello World"/>
<Button x:Name="button" Content="OK" Click="Terminate"/>
</StackPanel>
(I did modify the generated window size and title as well, but those are cosmetics and not required for Hello World functionality).
So I had to write seven lines (when also counting the one with nothing but a closing brace) to create a GUI Hello World. It sure is more than
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
} But then, hitting F5 is far easier than invoking the C++ compiler from a CLI.
My experience is that to make novices/students fascinated and eager to learn, you must help them to rapidly build something that has a resemblance to what they are used to see on the screen. At least 19 out of 20 have never ever realated to a CLI interface, but 20 out of 20 have seen windows, buttons, text fields etc. Console output does not give them a feeling of having taken the first step into making something "real". A GUI label and a clickable button, much more so.
|
|
|
|
|
Is Windows Forms a requirement? A major part of C# GUI programming today is done with WPF, Windows Presentation Foundation. You can easily fill a shelf with books on WPF. (Some of them unforunately spends a lot of words explaining how WPF differs from Forms, more or less assuming that you already know Forms!)
|
|
|
|
|
trønderen (@Member-8575121) said
Quote: Is Windows Forms a requirement? A major part of C# GUI programming today is done with WPF, Windows Presentation Foundation. If you do go down the WPF route have a look at "WPF 4.5 Unleashed" by Adam Nathan (Pearson ISBN 978-93-325-3603-6). I'm finding it quite digestible.
I've also used Charles Petzold's "Programming Microsoft Windows with C#" (Microsoft ISBN 0-7356-1370-2 - although I have a very old copy)
Some these books come in at a hefty price so also have a look at InformIT: The Trusted Technology Source for IT Pros and Developers[^]. I haven't used it in years but I had a colleague who swore by it.
|
|
|
|
|
I did a search on Amazon, under books. Amazon Book Search[^]. There appear to be quite a few. Some were older, but even those should get you started.
There are a few author's that I've found to be good, mostly the top names, like Charles Petzold[^] and I've had several Murach's[^] and liked them very much. The linked Murach's work might be a good starter, it is 2015 but thats not terribly old.
I'm sure digging through the links and reviews will find you something useful.
Jack of all trades, master of none, though often times better than master of one.
|
|
|
|