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
Brian_TheLion
Posts
-
Looking for a book on C# forms -
Looking for a book on C# formsThere 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
-
How do I load a block on a form at startupCan you give me an example please
-
Creating a Windows form program using C# 8.0Thanks Richard. I updated Microsoft Visual Studio today and now have a form displayed when using Net.Core Brian
-
Creating a Windows form program using C# 8.0In that case I'll need to use only Net.Framework
-
Creating a Windows form program using C# 8.0Thanks Dave. I found I had to dock some things such as toolbox so the interface becomes panels and is the way I want things to appear. Brian
-
Trying to get my block program workingI 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(Pla
-
How do I load a block on a form at startupThanks Griff. I'll try what you suggested.
-
Creating a Windows form program using C# 8.0Hi Dave. I tried clicking on Toolbox in the View menu but when I do that the only thing I see on the screen is a list of tools. I need to have both the form and the list of tools displayed on the screen at the same time. In past versions of C# things were put in panels on the screen so the form display was put in one panel in the middle of the screen and the list of tools was put in the left side panel. Can panels be setup with C# 8.0 like they have been in the past for the user interface?
-
Creating a Windows form program using C# 8.0On older version of c#. I could display the form on the screen and on the left side of the screen I had a list of tools such as button, textbox. I could then select an object from the list then drag it on the form and position it on the form where I wanted the object to appear (when I say object I mean things like buttons and textboxs). In C# 8.0 I don't seem to be able to do this unless you know of a way or something in the setup I need to change first.
-
Creating a Windows form program using C# 8.0When using NET.Framework I can't find anyway of dragging objects to a form (eg textbox, button). When using NET.Core I can't find anyway of displaying the form so I can place objects on the form. All I get is the code for the form. Has there been some major changes to version 8.0 of C# which prevents me from doing certain things, such as dragging objects such as a button on to a form?
-
How do I load a block on a form at startupI am able to load a block on to a form when I click a button (the button is on the form) but I want to move my code so that when the form loads the block on the form will also load. Where would I put the code? /// Graphics gs = this.CreateGraphics(); Pen p = new Pen(new SolidBrush(Color.Red)); gs.DrawRectangle(p, Goal);
-
Card shuffle program code help neededYou were correct Richard. When I tried the format code you offered I had left the comma out of the code and got an error I tried Console.Write("{0-19}", deck1.DealCard()); instead of Console.Write("{0,-19}", deck1.DealCard()); All is working find now thanks. Brian
-
Card shuffle program code help neededHi F-ES Sitecore. I had another look at the original and found that I had made a mistake. Console.Write("0-19)", deck1.DealCard); should have been Console.Write("{0,-19}", deck1.DealCard); I don't think a debugging the code would have lead me to the correct code but I can see your point in expanding the code over several lines. Brian
-
Card shuffle program code help neededThanks F-ES Sitecore for the suggested changes to the code. I finally have got this program to print out the cards. Good to make some progress. I altered the your code to Console.Write(card+","); so they would print in my preferred format. Brian
-
Card shuffle program code help neededHi Griff. Can you suggest somewhere that I might be able to find C# code listing for a card shuffing program or any card program. Brian
-
Card shuffle program code help neededHi Richard. Do you think there is some code missing? If this is the case then I may have to give up on getting this code to work unless you could suggest some extra code I could add to the existing code. Brian
-
Card shuffle program code help neededHi Griff. I'll give you an example why I'm not getting enought info when debugging. Please refer to my code that I posted a day ago . In the line return deck[CurrentCard++], If I put on cursor on deck[CurrentCard++] up pops the message "deck1 Card_Shuffle.Deck)" In the Console.Write line of code, if I put my cursor on deck1.DealCard() then up pops the message "deck1 Card_Shuffle.Deck). I can't see how I can find out what is wrong by the messages I get when checking these variables in the code. Brian
-
Card shuffle program code help neededHi Richard. Thanks fro the suggestion. I did as you suggested by got an error of "Input string was not in correct format". Brian
-
Card shuffle program code help neededHi Griff. I did try stepping through the code but with the way the program is written I can't always get exact values for some of the variables. I have sent the complete code in hope that you might spot an error. I posted the complete code as a reply to my first reply which I think was from yourself. Hoping you can help Brian