|
OK, I just tried it: A MainForm and a BaseForm from which it derives.
I add a small menu strip to the BaseForm, and assign Image properties to each menu item.
Derive the MainForm from BaseForm, and run it: MainForm has the menus, with the correct icons.
Check the Image for one of the BaseForm menu items, run it again: the menus are there, and are using the new images.
So what am I doing that is different from 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!
|
|
|
|
|
Thanks for the response. I don't know. On my simple test it also worked. But on my application that hundred of forms and a quite complex set of base forms it doesn't work. Really at a loss.
|
|
|
|
|
Are you running a single project solution, or are these mixed across assemblies?
"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!
|
|
|
|
|
Running across multiple assemblies.
I think I may have got to the bottom it. I created a brand new inherited form from the base form and it behaved correctly. On comparing the designer.cs code of the new form with one of my original (problematic) inherited forms, it looks like a load of extra code has been inserted into the code behind the designers.
For Example:
//
// bsiAdd
//
this.bsiAdd.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("bsiAdd.ImageOptions.Image")));
This seems to have also pushed the images into the resx file. If I remove all the bits of code for about 50 menu items then remove the images manually from the resx file then the inheritance seems to work properly.
The only thing I can think of which might have caused this is I put a DevExpress SharedImageCollection onto my main window form and I'm thinking that the nature of this control has perhaps caused this.
Issue I have now is I have to apply my manual fix to several hundred forms!
modified 27-Aug-20 10:07am.
|
|
|
|
|
Intern?
Office Junior?
Someone you can con into 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!
|
|
|
|
|
Good idea unfortunately, it gets weirder by the minute. If I apply my fix then open the designer and make any change at all to the design surface of the screen and save it, it puts the code back I deleted and re-adds the images back into the resource file!
|
|
|
|
|
At a guess it is because you are getting the form from a resource file, the above tests are probably just using an inherited form and not a resource object.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
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.
|
|
|
|