There are a lot of beginner and even intermediate level developers that have no idea how to access/modify a forms objects/methods from within a different class. I’ll show you the easiest practice of this.

First we have to make a reference. We must use the ‘protected’ keyword. I use the same name as the windows form that way it is easy to keep track of variables.

capture2 C# Access A Forms Controls Within A Class

Once that is done you must set each method and object you want to access to public. You do this from the Forms Designer Class.

capture C# Access A Forms Controls Within A Class

And that’s it. With just 2 lines of code you can now access you forms controls and methods.

[Sorry for the images of the code, my code-box plugin is broken]

Popularity: unranked [?]

What’s Going On?

Got some emails asking what’s been going on. I know I haven’t posted in a while. Some people miss my daily code snippets and short tutorials. I’ve been working hard on an anti-cheat system for BHD with http://cheatsense.com

I haven’t completly neglected the site. I’ll post some code tutorials tonight on a few more hashing techniques and string encryption. I will also be posting soon a tutorial on how to control a forms events and controls from within a different class. Unlike VB.NET, C# does not automatically inherit the forms methods and control methods.

I’ll also talk about obfuscation and .Net application security, secure string and anti-debugging methods.

Popularity: unranked [?]

.NET Gravatar Library

I’ve updated my Gravatar source. I am no longer working on the control version. I have focused my attention to a library model. With the library you are able to manipulate the image more then you could with the control. The image is stored in memory as passed as an image. I am working on arrays that will allow you to pass an overload containing a list of emails and return the Gravatar in the given order.

You can find out more here!

Popularity: unranked [?]

GravatarGet: Source Code

I’ve updates the GravatarGet page. I’ll be explaining the source code and releasing a major portion of the code. There’s already been over 5,000 downloads and the number is growing everyday. There are reports of bugs and what not, I will address them here.

Default Icon Struct:
I did this so we wouldn’t have to remember the names of the 3 fallback icon sets Gravatar offers.

Rating Struct:
Sure, there are only 4 ratings(G, PG, R, X) but maybe someone don’t know that. So I created a struct for this as well.

Some people are having trouble returning an image into memory. I recommend using MemoryStream for this. You can also attach the Gravatar to a listbox, combobox,textbox and almost any other control applicable.

So check out the Gravatar page and enjoy!

Popularity: unranked [?]

Rcon & C#

As some of you know, I’m working on an Rcon Manger for COD4/5. Some of you want to know how I am parsing/prepping the command to be sent. I’ll share with you my method of parsing the command. I don’t want to divulge too much information as I’m not done with the project yet.

public byte[] prepCommand(string command)

{

byte[] bufferTemp = Encoding.ASCII.GetBytes(command);

byte[] bufferSend = new byte[bufferTemp.Length + 4];

//intial 5 characters as per standard

bufSend[0] = byte.Parse("255");

bufSend[1] = byte.Parse("255");

bufSend[2] = byte.Parse("255");

bufSend[3] = byte.Parse("255");

//copying bytes from rcon to send buffer

int j = 4;

for (int i = 0; i < bufferTemp.Length; i++)

{

bufferSend[j++] = bufferTemp[i];

}

return bufferSend;

}

Popularity: unranked [?]

C# Convert Decimal to Integer

Having trouble converting your decimals into integers? A lot of people are. It’s actually pretty easy. Bellow is a short example!

Here I am using a Numeric Up/Down control and need to convert the value to an integer to pass it to my picturebox control.

picturebox1.Width = Convert.ToInt32(Math.Ceiling(numericUpDown1.Value));

Using ToInt32.Ceiling() it will return the smallest integer greater then or equal to the decimal passed.

Hope this helps with your decimal to integer problems!

Popularity: unranked [?]

Gravatar .NET Control

UPDATE AND PAGE HERE

I’m working on a .NET Gravatar control. A user will be able to retrieve the given emails avatar, or fallback to a default avatar provided by Gravatar.  The developer will be able to control the [size],[rating],[fallback image]. 

Why? That’s easy! Maybe you are developing an application that involves chat, email, p2p activities or something like that. Isn’t it nice to show your picture? I’m sure there are other applications for this type of user control.

        GravatarGet1.Email = "dremation@gmail.com"
        GravatarGet1.ShowGravatar(60, "g", "identicon")

The parameters, (60, g, identicon) are the parameters Gravatar allows to be passed.

Size:  Any number from 1 to 512 
Rating: G, PG, R, X
Default: identicon, monsterid, wavatar

test1 Gravatar .NET Control

In the next release I plan on easy methods of defining the parameters. I will also include image ttiels, information titles and context menu support.

Please leave comments for errors, suggestions, ideas and bugs.  

download button Gravatar .NET Control

Popularity: unranked [?]