SoftwareSamples #2 – Run an application with C#


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RunNotepad
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Process.Start("notepad.exe");
}
}
}

Here is what you should do if you want to open a file in Notepad:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RunNotepad
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Process.Start("notepad.exe", "C:/path/filename.txt");
}
}
}

Replace C:\path\filename.txt with the path and name of the file. Also, you would usually do backward-slash in Windows instead of forward slash. However, if you use backward-slash the application will run up a bunch of errors.

You can change the application that is launched. If you had SeaSurf installed at C:\Users\yourusername\Desktop\SeaSurfForWindows.exe, for example, you could launch that.

 

User Input in Windows Console Application – C#


 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InputTest
{
class Program
{
static void Main(string[] args)
{
System.Console.Write("SOFTWARE TERMS OF USE\nYou can use the SoftwareSamples from Chas for free, for demonstration purposes or to help you with your coding, including for business or professional use. You do not have to give credit to Chas AT ALL, though it would be appreciated.\n");
System.Console.WriteLine("Do you accept the Terms of this software?");
String agree = System.Console.ReadLine();
if (agree == "yes")
{
System.Console.WriteLine("Terms accepted. You may use this software");
}
if (agree == "YES")
{
System.Console.WriteLine("Terms accepted. You may use this software");
}
if (agree == "Y")
{
System.Console.WriteLine("Terms accepted. You may use this software");
}
if (agree == "y")
{
System.Console.WriteLine("Terms accepted. You may use this software");
}
if (agree == "n")
{
System.Console.WriteLine("You did not accept the terms. You may not use this software.");
}
if (agree == "no")
{
System.Console.WriteLine("You did not accept the terms. You may not use this software.");
}
if (agree == "NO")
{
System.Console.WriteLine("You did not accept the terms. You may not use this software.");
}
if (agree == "N")
{
System.Console.WriteLine("You did not accept the terms. You may not use this software.");
}
}
}
}

Hi guys, here is how to use input in a Windows Console Application. In this sample, the user has to type YES, yes, Y or y to get access to the software, and if they type NO, no, N or n they will not get access to the software. There is no “software” that will be installed in this script. This is only for demonstration purposes.

A new Internet Meme I created just now – OK buttons and errors!

If you want the Error application I made myself, get it from https://1drv.ms/u/s!Asov5XVfbr4hlQ2cMOBrz2bRY2en. If you get an error when trying to launch it, that is the point (If the error doesn’t look too normal to you anyway) 🙂 🙂

Here is an Internet Meme you may all share on your own blogs and on any other services you want to share on – it would be lovely if you gave me some credit for this meme – I did make it!

errorme

The point of this meme is to demonstrate that clicking “OK” when encountering an error means you are agreeing with it, but with some error messages that is the only option. This one doesn’t have a close button, only an OK, though it can be closed in the taskbar though, by right clicking and clicking close window.

The “unfortunately this app has stopped” error on Android, even if you tap in the background, still requires you to press OK, with the only other way powering your Android Device off and on again to get rid of the error.

That’s all I have to say at the moment, bye bye!

Epic Chas Gamer 😀

One lovely blog award – who are my favourite bloggers?

This challenge has spread across the internet like fire (I didn’t create this challenge) so I have decided to do one. Basically, I have to tell you 7 things about my character. And up to 15 bloggers I enjoy. I have over 40 followers, but as there are limits (a few don’t have blogs) and you can only do up to 15. I am sorry if I do not include you!

So, here are the 7 things about me!

1. I think about my web browser project, ECG SeaSurf , for a lot of my time. I love it because the world wide web is a big place, and making software that allows people to browse such a great thing makes me feel special.

2. I do not try to block the spotlight from other developers as I love seeing what others have produced too, and I love getting inspired.

3. I love playing video games because they are extremely fun, and it feels like I am in the game (no VR here!). They also take stress away.

4. I love writing stories, to entertain people. I am writing a story called Sir Wolf’s Castle, about Minecraft wolves and a villan called Sir Bum-Smacker.

5. I love looking at over blogs and leaving feedback and liking posts because I don’t want to look selfish.

6. I love ketchup. It is an awesome sauce.

7. There are lots of other things I love but don’t blog about: Star Wars and Legends of Chima, for example.

Now, here are my favourite bloggers: I DO NOT ACCEPT RESPONSIBILITY FOR LINK CONTENT CHANGING

1. Codeinfig:

An author of a coding language called Fig, a coding enthusiast, and much more. Check out his blog at codeinfig.wordpress.com!

2. Jacque:

If you want to go beyond my app-making service (I would recommend trying it first and requesting a removal if you don’t like it), then Jacque is the person for you. He can even get your app published to the Play Store (I didn’t ask for an app because I can make one myself).

Check out his blog at themarvelousmind.com

3.  ARJ

If you want a guide to coding and you want to be a pro, then ARJ’s blog “A bit of everything – copy” is the place for you. He has another blog, pythongr.wordpress.com, which is worth checking out too.

Find his main blog at abdurrahmaanjanhangeer.wordpress.com

4. Daniel He hetianding

A Minecraft enthusiast, this blogger creates maps and then publishes them.

Find his blog at worldofmanyworlds.wordpress.com.

5. LZH

A real tech enthusiast, admin of a website called TechCentral which contains everything tech.

Leave a comment or like at limzhenghong.wordpress.com

6. AntonioWestley

A master blogger, who loves posting about sites he recommends.

Check out his active site at alltheeabove.wordpress.com.

Check out his inactive site at antoniowestley.wordpress.com

7. antepher

A real ESP8266 and Arduino enthusiast, as well as Python Expert, antepher maintains a blog called techtutorialsx.

Like and comment on his blog at techtutorialsx.wordpress.com!

8. Paul Sinha

One of my first followers, Paul Sinha appears on the Chase and is really funny.

Check out his blog at sinhaha.com

9. Old and New Reviews

Reviewing and playing video games, I enjoy reading this blog.

Follow the blog at oldandnewreviews.com!

10. Is there any blog you recommend?

I can’t think of a tenth, but I want to reach 10, so if you recommend a blog, plz leave  a comment.

PS: The rules (I have forgotten the URL to the original creator’s blog) also mention that you should post about being chosen. So, thank you codeinfig for choosing me! SO, remember that!

Epic Chas Gamer 😀

 

 

 

How to create a basic web browser in Visual Studio 2015

TESTED WITH VISUAL STUDIO COMMUNITY 2015. SHOULD WORK WITH OLDER AND NEWER VERSIONS BUT NOT GUARANTEED.

Here is how to create a simple web browser with Visual Studio. This example covers the basics of the WebBrowser tool in Visual Studio and how it works. The web browser example contains only the basic components of a web browser: an address bar and a button that tells the program to load the URL entered into the address bar.

First, fire up Visual Studio and click Create New Project. Choose Windows Form Application. Call the application what you want your web browser to be called. As this is not SeaSurf or WebNet, I am calling it WebBrowserExample but you can call it what ever you like.

winformbrowser

Click OK and the project should load.

You should see the designer for the project. Resize the window shown in the design.

screenshot-5

screenshot-6

Click on the properties of Form1, and change the text to what you want the title of your window to be.

Then click on Toolbox and drag in a Button and a TextBox.

Then drag in a WebBrowser.

screenshot-7

Now double click on the GO! button (or whatever you renamed it to in properties) and you should see the application’s code.

Here is the code for the GO! button:

string Webpage = textBox1.Text.Trim();
webBrowser1.Navigate(Webpage);

Save and run the web browser. Build “yourappname.exe” to be able to share it online!

screenshot-8

Hope you like it! I may post future tutorials about adding Back and Forward buttons.

Epic Chas Gamer 😀