I wanted to list out some data for a page that wasn’t being pulled from a database but I didn’t want to write out the table and all that. So I dropped a datagridview on to the webpage and wrote some code in the code behind.
Protected Sub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs)HandlesMe.Load
PopulatePCGrid()EndSubDim DT AsNew DataTable
Dim DR As DataRow
PrivateSub PopulatePCGrid()Dim DS AsNew DataSet
DT =New DataTable("items")
DR = DT.NewRow
AddRowToGrid("Operating System", My.Computer.Info.OSFullName.ToString)
DR = DT.NewRow
AddRowToGrid("Total Memory", ((My.Computer.Info.TotalPhysicalMemory/1024)/1024).ToString("N0")&" MB")
grd_Specs.DataBind()EndSubPrivateSub AddRowToGrid(ByVal description AsString, ByVal data AsObject)With DR
I will explain this as best as I can.
We create two variables, 1 for the Data Table and 1 for the Data Row.
When we get into PopulatePCGrid we create a new data set and set up the data table to match the gridview layout. If these fields do not match you will get an error on page load. So make sure the fields you want exist in both the gridview and in the code behind.
I wrote a sub proceedure to add rows to the dataTable. This isn’t required but it’s best to break out code that you will be using over and over again and make them into functions /subs.
So we call the proceedure and pass in description and data. Data is an object simply because it could be anything. I didn’t want to limit it to a string or integer because that wouldn’t be true (and in fact on the actual page I wrote this for it wasn’t true).
We then add that row to the data table and go back to PopulatePCGrid to finish the rest of the code. We create a new Datarow and then continue to add more information to the Data table. After we finish that we bind the datagridview and we end up with something like this:
Someone was asking how to do multi-threading in the shoutbox and my original example didn’t work because of cross-threads. This basically means I couldn’t set the value of a control within a thread since it’s considered a different process. Well I did manage to get it to work and I figured I’d post the code here. I will also include the source code both both the VB.net and C# versions below.
I have been working on making some trainers for some games and I wanted a basic way of showing that a cheat was enabled.
I couldn’t figured out how to draw to the screen so I figured the title bar would be fine.
This was something I used in order to try and keep my programs down to 1 file. Instead of including a seperate file that handled the updating, I simply embedded it into the main program. To do this all I did was make it a resource and when I needed to use it I would write it out to the root directory that the program was in.
To add a file as a resource, right click your project and click properties.
Click on the Resources tab. On the top click on strings and select files. Drag and drop the file you want to include as the resource into this window.
Click save or save all.
Now when you decide you need to use that file you can write it out to a directory then run it.
This was a feature I have been planning for some time and finally got around to working on it. Basically it will have default folders that will be in the program. These folders will be where your temp files are located. All you would have to do from here is click the clean button next to the item and it will remove those files.
You are also able to add your own folders that you wish to be included in the program. So anytime you start up the application you will get the list of folders and the amount of space they are taking up.
The design in the video isn’t what I plan on having it look like on release but it’s functionality will be the same.
-Added the ability to stop multiple processes at once. Simple control click the ones you want to stop and click End process.
-Forms have changed, new features will be added that deal with clean up on temp files and fixing other policies within windows
If you have the program already simply click file and check for updates. It will say an update was found click yes and then in the new windows click update. Or go to the download link in this post Download