Jump to content


Check out our Community Blogs

CommittedC0der

Member Since 13 Nov 2009
Offline Last Active Apr 07 2016 04:17 PM
-----

#667424 Children &internet

Posted by CommittedC0der on 16 January 2014 - 10:48 AM

As LKP mentioned AdBlock is pretty good at what it does.  If you want more control you can also check your router as some of them have built in parental controls.  You should be able type 192.168.1.1 into your browsers address bar and log into your router with:

 

username: Admin

password: password

 

Otherwise you can check the documentation.  Good luck.

 

EDIT:  And now I see this thread is almost 2 years old...


  • 1


#615583 gotoxy(5,10)

Posted by CommittedC0der on 29 November 2011 - 02:42 PM

Will this help you? mousemove - Simulating mouse movement (C#) - Stack Overflow

~ Committed.
  • -1


#614070 How do I earn revenue from my game site?

Posted by CommittedC0der on 14 November 2011 - 02:05 PM

Well most sites work like this(Kongregate example). Players upload a game and gets %40 of the game ad revenue and the site keeps %60. This doesn't mean you have to have 5,000 ads a page, but more is better. :P So now the developer makes money from his game and uploads more games, intern you make even more because you get %60 revenue from every game that's uploaded to your site.

You can also create currency that can be bought with $ that allows game upgrades/unlock-able content.

Hope that helps ~ Committed.
  • 1


#608245 C# - Event Handlers, Part I

Posted by CommittedC0der on 26 August 2011 - 11:35 AM

Hello everyone! Today we'll be covering basic control event handlers, I hope you enjoy it. :)

Event List
Each control has its default event handler that is automaticlly created when its double clicked. The button has its Click() event, the textBox with the TextChanged() event. Sometimes you want to add an event that also pretains to the control but isnt the defualt event. The easiet way to do this is click the control of which you want to create an event for and goto it's properties window. From here you should see a lightining bolt, click this and you should see a large list of events you can create for the control.
events-Tut.png
Once you've found the new event you want to create double click it and you'll be directed back to code view with a newly created event function looking something like this:
events-Tut-New.png

Now you maybe wondering why you cant just save yourself some trouble and just write
private void button1_FontChanged(object sender, EventArgs e)
{

}
Instead of adding it through the events list? Well you can do this, but this only creates the event function, you would still have to create an event handler in the Designer.cs file. Since were at it let's go over how to do this.


Designer.cs & Form1.cs Coded Events.
First open your Designer.cs file and find the control you want to add an event for, then add this.
 this.controlNameHere.EventNameHERE += new System.EventHandler(this.FunctionName);

Here is what mine looks like with the fontChanged event in place.
events-Tut-Design.png

Don't forget to add this to your form code when your done in the designer.
private void FunctionName(object sender, EventArgs e)
{

}

There! Now you know how to use both ways of creating an event, but there is still one other way that is slighlty easier then the Designer.cs method.

This method requires you to create a new eventHandler much like we did in the Designer, except this time we add the code in our Form.
controlName.eventName += new EventHandler(funtionName);    

Here's what mine looks like, event function included.
events-Tut-Form.png


Tip: When adding a new event to a control you will see a lightning bolt next to the event in the auto-complete window.
events-Tut-Auto.png


Thats the basics of creating event handlers in C#. If you want to know how to add an event that isnt covered in the event list? Well that will be covered in Part II.

As always comments, questions, or +rep welcome, and dont forget to rate this thread.
Thanks ~ Committed. :)
  • 1


#607648 C# - Sending Email Through SMTP.

Posted by CommittedC0der on 17 August 2011 - 06:50 AM

Hello! Today we'll be sending emails through SMTP(Simple Mail Transfer Protocol). This is rather easy but does require a valid email account.


Before we can even start we must add the .Net and .Mail libraries.
using System.Net;
using System.Net.Mail;


This will allow us to access SMTPClient, MailMessage and NetworkCredentials, which we'll go over shortly.


Authentication.
This is where the valid email account comes into play. You must have a valid email account(with password) to give our program a place to send the mail from.
NetworkCredential cred = new NetworkCredential("YourEmailAccountAddress", "EmailAccountPass");
With our credentials filled in we can now send mail from our account, which we'll get to momentarily.


Creating an Email.
To send an email we must first create a new mailMessage(an email) to send.
MailMessage msg = new MailMessage();
Now with an email created we must add some details to it, including; To, from, subject, ect.
msg.To.Add("emailRecipient@gmail.com");  [COLOR=#006400]// Add a new recipient to our msg.[/COLOR]
msg.From = new MailAddress("YourEmailAccountAddress");   [COLOR=#006400]// Read below.[/COLOR]
msg.Subject = "A subject.";             [COLOR=#006400]       // Assign the subject of our message.[/COLOR]
msg.Body = "Hello, this is my message.";   [COLOR=#006400]// Create the content(body) of our message. [/COLOR]
All of the above is very self explanatory. As for the .From property, it can be changed from you email address, but when the email is opened it will still read as the email address of the account from which the email is sent.
If you dont understand, lets say the details are filled out as below.
NetworkCredential cred = new NetworkCredential("prankster@gmail.com", "EmailAccountPass");
msg.From = new MailAddress("CrazyGuy@insane.com")

When you recive the email, it will still say from "Prankster@gmail.com" because thats where its sent from, we just arnt allowed to send an email without filling in its .From property.


Sending the email.
Now we must create a new Smtp client to send our email.
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
We created a new client which has two parameters (Host, Port). The host is where we'll be sending the mail from, this should be the same as your email account. I have a Gmail account, so I use "smtp.gmail.com" as my host. The only reason we use port 25 is because it's the defualt Smtp port, although if you wish, you may use another port.
(At the end of the tutorial I will post alternative hosts.)


Now we fill in the client details and send the email.
client.Credentials = cred; // Send our account login details to the client.
client.EnableSsl = true;   // Read below.
client.Send(msg);          // Send our email.
Enabling SSL(Secure Sockets Layer, encyription) is reqiured by most email providers to send mail, thus we the reason we enable it. :)


Run your program and check your email, if all is well you should see.
emailOutput.png




Host List:
smtp.gmail.com // Gmail
smtp.live.com // Windows live / Hotmail
smtp.mail.yahoo.com // Yahoo
smtp.aim.com // AIM
my.inbox.com // Inbox
( I havent tested them all so just let me know if one of them doesn't work. :) )


I think that covers most things, I hope this tutorial was short and sweet. Any comment, questions, or rep welcome.

Thanks ~ Committed.
  • 2


#607589 Visual studio question

Posted by CommittedC0der on 16 August 2011 - 02:07 PM

I dont think there is property to set to fix this, but you could set the form back when someone try's to move it.
int xPos = 50; [COLOR=#006400] // x Locked position[/COLOR]
        int yPos = 50;  [COLOR=#006400]// y Locked position[/COLOR]
private void Form1_Move(object sender, EventArgs e)
        {
            this.Location = new Point(xPos, yPos);
        }

Good luck ~ Committed. :)
  • -1


#607297 C# - Deploying Your Project via VS Setup Wizard ( Installer )

Posted by CommittedC0der on 14 August 2011 - 12:26 PM

Hello everyone, today we'll be learning how to setup a basic installer for our program via Visual Studio 2008 Setup Wizard. This is one of the easiest ways to create an installer for your program, but it does have one large requirement:
  • Visual Studio 08/10 (cannot be express editions)
If you have this then let’s go! :)


Adding the wizard.
Firstly you should have the project you’re looking to create an installer for open. Once open we need to add our Setup Wizard by going to File>Add>New Project, and selecting Setup Wizard from the "Setup and Deployment" category.
addNewWizard.png

Name the wizard according to your application(Adding "Install" to the end is nice for the user, e.g. "AppName Install")


You will now be presented with a welcome screen which asks you to click next. Now we have the "project type" screen which presents us with four options of how the files will be installed on the computer. For this tutorial we are creating a normal Windows applications so we'll chose option one. The next screen is the "project output" screen which asks what project output we want to include. For this tutorial all we'll need is Primary output(the exe).
output.png

Note: If you click on the other options a small description will be shown.


With the next screen we are allowed to add files such as readMe or html pages. I’m going to add a readme just because I want to, I'll then press next.
All that left now is to check the last screen to confirm everything is filled in correctly and press next.


Details
If everything went well you should see this screen.
filesSetupWizard.png

This is where we'll edit some details to install the program where and how we want.


Shortcuts
First let's add a shortcut to the desktop and program menu. Double click the "User's Desktop" folder from the left and you'll be shown the content of the folder on right(blank atm). Right click this blank area and click "Create New Shortcut" and a new dialog will open. With this dialog we must select what we want the shortcut to connect to, in this case the application, so in the dialog double click the "Application Folder" and select "Primary output..." press ok and name the shortcut(The text you want show on your desktop icon).
addShortcut.png

Now lets add an icon to our shortcut! Right click your shortcut and open the properties window, from here choose "(browse)" from the icon property. Once again a dialog will open, from this dialog we go into the application folder again and click add file. We then browse for the icon we want and press ok.
addIcon.png

Now you can repeat the process for the "User's Program Menu" folder to place a shortcut on the program menu.


File Path
Now that we have some shortcut's lets change the installation path of our files. Right click the "Application Folder" and open the properties window. Near the middle you should see "DefaultLocation" filled in with
"[ProgramFilesFolder][Manufactur]/[ProductName]" this sets the file path to
"C:\Program Files(x86)\Micorsoft\SetupWizardName", but as it turns out you probably don’t work for Microsoft and may not want your program folder named after the Setup Wizard. Let’s change the value to "[ProgramFilesFolder]MyCompanyName/MyAppName". There, now you have your files right where you want them.


Once you’re done editing and adding, right click your Setup Wizard in the solution explorer and click Build!
buildInstall.png


There you have it, that’s the basics of creating a setup wizard for your application! If some people would like I could make a tutorial going into some more detail about other options of the wizard e.g.
moreDetails.png


Congratz you now have an installer worthy of being online! Your installer can be found in "Wherever\Visual Studio 2008(or 2010)\Projects\ProjectName\SetupWizardName\Debug\".

Any questions, comments, or rep welcome.

Thanks and good luck ~ Committed. :)
  • 1


#607041 C# - Settings ( Savable Variables )

Posted by CommittedC0der on 11 August 2011 - 08:37 AM

Hello all, today we'll be going over Settings. I hope this tutorial covers all you'll need to know, and you understand how to use Settings to your advantage.


What is a Setting?
A Setting, in a nutshell, is a savable variable. You can set the value of the Setting and once you restart your application it doesn’t lose or change its value, pretty handy.


When should I use settings?
Settings should be used when you have a variable you need to keep track of for your user. Example uses are, color Scheme’s, pop up tips, auto updating. All of which need a variable that does not lose it value after a restart.

Also note that, Settings should not be used as a database to hold large amount of variables.


Making your first Setting.
So to create a Setting variable you'll need to create new project, naming it however you please. Once done go ahead and add 1 button and 1 ColorDialog(for this tutorial we'll be change the color Scheme, as mentioned).


With both controls added, please double click the button and add.
colorDialog1.ShowDialog();
            this.BackColor = colorDialog1.Color;
Simple enough, change the form color to the chosen colorDialog color. Run your program and make sure all works. As you run your program you may notice that no matter what color you change the form to, it always resets to its default gray once it’s closed and restarted.


To fix this we must create a Setting variable to hold our color. To do this, right click your project in the solution explorer and click properties.(You can aslo use Project>Properties. from the menu of VS) You will now see to the properties window, from which you should click the Settings tab.
C#-settings.png


Here we are! This is where we will be creating our settings. On this window you will see the setting variables 4 properties. 3 of the 4 you should understand, the only one you may not is the scope.


The scope has two values, "User" or "Application". User is a variable that can be assigned at design time(where we are now, the code view) and be changed by the user at run time(while our program is running). Application can only be assigned during design time, not run time(read only at run time). So for this tutorial we want the user to be able to change the Settings variable, thus we leave it at "User". Here is what my settings now looks like.
C#-setting-value.png


As you can see I named it "formColor" and changed its type to "System.Drawing.Color" so it can hold color data.

Great. Now we have a setting, let’s assign some values.


Reading & Changing Setting values.
Open up your button code once again, and add.
Properties.Settings.Default.settingVariableName = colorDialog1.Color;
Properties.Settings.Default.Save();

First we access the variable through the project properties into default settings where the variable is, once accessed we assign the Setting value to the color chosen from the dialog, then we save the value so we can use it even after the program is restarted. Now when you pick a color its saved in our Settings variable, but we still need to get the value on startup to change the form back to its saved color.


In your Form() function add this code.
this.BackColor = Properties.Settings.Default.settingVariableName;
We simply assign the forms backColor to the value of the setting variable. Tada, your form now saves and restores the chosen color scheme from the Setting variable.

You can make the setting variable any type you want to save data for lots of situations, just don’t for get to use the Save() after any changes. I hope this tutorial was informative and easy to understand, any questions, comments, or rep welcome.


Thanks ~ Committed.
  • 1


#592910 printpreview for datagridview

Posted by CommittedC0der on 01 March 2011 - 06:29 PM

This tutorial should help you. :)
How To Print a Data Grid in C# and .NET

~ Committed.
  • 1


#592891 Working With Information Across Forms.

Posted by CommittedC0der on 01 March 2011 - 02:51 PM

Hi, Tonchi. I assume "Tablica1" is a control on the form? Do you follow this step?

Now you probably thinking what am i doing wrong?!? I have an error:
'WorkingAcrossForms.Form1.button1' is inaccessible due to its protection level'

This is because Form1's button properties are set to private. To fix this click the button on Form1 and open the properties window, scroll down until you see Modifiers and change it from 'Private' to 'Public'. Now run your application, and Form1's button text should change!

~ Committed. :)
  • 1


#592583 doubles places past decimal....

Posted by CommittedC0der on 26 February 2011 - 12:04 AM

Try this,
Decimal Format : Double « Data Type « Java Tutorial

~ Committed.
  • 1


#592582 Java Programming Question

Posted by CommittedC0der on 25 February 2011 - 11:51 PM

Try changing this:
int listsize = level.size();
to this:
int listsize = level.size()-1;
That should work, but Im not sure cause I dont have a Java IDE.
But anyways, your getting an error because an array's value's start at 0. When you call the ".Size" function, it returns the size of the array. So for example you would have an array like this:(pseudo)
ArrayName[0]
ArrayName[1]
ArrayName[2]
ArrayName[3]
Now when you call the ".Size" function it returns 4 because there's four values in the array. But really the answer is 3 because we start holding value's at 0 not 1.
Hope you understand, Im pretty tired lol ~ Committed.
  • 1


#592493 Calorie Counter Project Help Thread

Posted by CommittedC0der on 25 February 2011 - 11:17 AM

Thats because your adding total_numer with input_number. And since total_number is never assigned its basically saying 0 + input_number.
This code should work, and i think you'll understand it.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click          
Dim input_number As Integer         
input_number = Convert.ToInt32(TextBox1.Text)    
     
[COLOR=red]Dim input_number2 As Integer
input_number2 = Convert.ToInt32(TextBox2.Text)[/COLOR]         

Dim total_number As Integer         
total_number = [COLOR=red]input_number2[/COLOR] + input_number          
TextBox2.Text = Convert.ToString(total_number)     
End Sub

Good luck with your project ~ Committed. :)
  • 1


#592344 Visual Basic Console Program

Posted by CommittedC0der on 24 February 2011 - 07:14 AM

Why would you want to use notepad to edit code? :blink: Anyway im not sure how you would do that, I dont see anything on Google saying how. :worry:
~ Committed.
  • 1


#592023 Application with Accessibility for Blind People

Posted by CommittedC0der on 21 February 2011 - 05:57 PM

What do you mean by interaction? Like the computer says " 1 + 1 = ?" and waits for the users input? You can do that with C#. Or do you mean interaction with software like JAWS?

~ Committed.
  • 1




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download