|
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.
|
|
|
|
|
|
I get this message when I try to run my c# block code program.
I'm hoping someone can suggest what I need to change or add to my prgram so it will work.
Error CS1061 'Form1' does not contain a definition for 'Form1_Load' and no accessible extension method 'Form1_Load' accepting a first argument of type 'Form1' could be found (are you missing a using directive or an assembly reference?)
TRIED TO FORMAT CODE USING ```
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BlockGame
{
public partial class Form1 : Form
{
private Rectangle Goal = new Rectangle(350, 600, 50, 50);
private Rectangle Player = new Rectangle(350, 0, 50, 50);
private Rectangle Enemy1 = new Rectangle(0, 150, 75, 75);
private Rectangle Enemy2 = new Rectangle(599, 350, 75, 75);
public Form1()
{
InitializeComponent();
this.MaximumSize = new Size(750, 750);
this.MinimumSize = new Size(750, 750);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(Pens.Red, Goal);
e.Graphics.DrawRectangle(Pens.Blue, Player);
e.Graphics.DrawRectangle(Pens.Red, Enemy1);
e.Graphics.DrawRectangle(Pens.Red, Enemy2);
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
int PlayerX = Player.Location.X;
int PlayerY = Player.Location.Y;
switch (e.KeyData)
{
case Keys.Up:
Player.Location = new Point(PlayerX += 0, PlayerY -= 20);
this.Refresh();
break;
}
}
//detect if any rectangles hit each other
public void HitDetect()
{
if (Player.IntersectsWith(Goal))
{
MessageBox.Show("You Win!");
}
int PlayerX = Player.Location.X;
int PlayerY = Player.Location.X;
if (Enemy1.IntersectsWith(Player))
{
Player.Location = new Point(PlayerX = 350, PlayerY = 0);
MessageBox.Show("You Lose!");
}
if (Enemy2.IntersectsWith(Player))
{
Player.Location = new Point(PlayerX = 350, PlayerY = 0);
MessageBox.Show("You Lose!");
}
}
//As when we were moving the player we need variables for the two enemies X and Y location
private void timer1_Tick(object sender, EventArgs e)
{
int EX1 = Enemy1.Location.X;
int EY1 = Enemy1.Location.Y;
if (Enemy1.Location.X > 600)
{
Enemy1.Location = new Point(EX1 = 0, EY1 = 150);
}
Enemy1.Location = new Point(EX1 += 30, EY1 += 0);
this.Refresh();
// To make the game hangler make the enemy go the other way
int EX2 = Enemy2.Location.X;
int EY2 = Enemy2.Location.Y;
if (Enemy2.Location.X < 0)
{
Enemy2.Location = new Point(EX2 = 599, EY2 = 350);
}
Enemy2.Location = new Point(EX2 -= 30, EY2 += 0);
this.Refresh();
// Put limits so player can't go outside the form
if (Player.Location.X > 650)
{
Player.Location = new Point(Player.X -= 20, Player.Y += 0);
}
if (Player.Location.X < 0)
{
Player.Location = new Point(Player.X -= 20, Player.Y += 0);
}
if (Player.Location.Y > 590)
{
Player.Location = new Point(Player.X -= 20, Player.Y += 0);
}
if (Player.Location.Y < 1)
{
Player.Location = new Point(Player.X += 0, Player.Y += 20);
}
HitDetect();
}
}
}
'''
|
|
|
|
|
Somewhere in the designer you said you wanted to handle the "form load event", but you're missing the "handler."
How to: Create Event Handlers Using the Designer | Microsoft Docs
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
|
|
|
|
|