How To Get Mouse Location(X,Y) In C#

I know this is very basic but i am bored so writing this .
The program we are going to make will show you the mouse cursor location, okay first of all click your form and then go to event (the lightning icon in your properties tab) and then search for MouseMove and just double click on it.
How To Get Mouse Location(X,Y) In C#
After that you will fall into the mouse_move event , go to designer and add two labels and just write down the below codes in MouseMove
label1.Text = "X : "+e.X.ToString();
            label2.Text = "Y : "+e.Y.ToString();

Now debug and try moving your mouse .

How To Add Values To ListBox In C#

Adding values to a listbox is something really easy anyways if you don't know how to add values to a listbox then here you go.

You need to add these things to your project first of all
  1. Three buttons (add,show,clear)
  2. Listbox
  3. Textbox

Inter Process Communication in C#

Introduction

Alright, so you guys might know about the famous web-browser, Google Chrome. One remarkable thing in this (pretty) simple looking application is the use of a programming technique called IPC or Interprocess Communication; with IPC you can communicate with another process without invoking and other third party events. One of the most irritating about .Net is that the app freezes if it is trying to communicate with a web-service. With IPC we can eradicate this problem.

What can you do with it?

So, lets first take an example of what exactly we can do with this: suppose that you have a licensing application named LicMan.exe and a processing app called LicPro.exe. LicMan has the UI and every other part of standard human interference. And LicPro.exe just takes the License Key provided and then processes it and sends it back to LicMan.exe for display. This way the app would not hang and you have a happy customer :-)

Lots of bad ways of doing IPC:

  • Shared Memory: Difficult to manage and set-up.
  • Shared Files / Registry: Very slow doe to the writing & reading to/from disk. Difficult to manage as well.
  • SendMessage / PostMessage: Locks up the UI thread while the message is processed. Messages are limited to integer values. Can't communicate from a non-admin process to a admin process. Assumes that your process has a window. 

How To Make A Proxy Grabber In VB.NET

How To Make A Proxy Grabber In VB.NET
Okay now we are going to make a proxy grabber , so what is this proxy grabber thing ? first of all proxy is something that covers your ip address(it's like you put a jacket when snow falls lol ) and grabber ? grabber is  meant for something that will fetch you things or whatever it's called . For this tutorial we are using websites that provides proxies so we use httpwebrequest and grab the proxies from the website and we check for the right format by using regex .

Let's start ,
First go ahead and create a new project and we need a ListBox and Three Buttons so just add them . After adding them to your form arrange as you see in the below picture.
How To Make A Proxy Grabber In VB.NET
Now coming to the coding point , first add Imports System.Text.RegularExpressions namespace because we use regex as i said before , first open the button click event which is the grab button and add this codes.
 'creating our httpwebrequest target NOTE: you can use any websites that use to provide proxies directly
        Dim the_request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://proxy-ip-list.com")
        'creating the httpwebresponce
        Dim the_response As System.Net.HttpWebResponse = the_request.GetResponse
        'defining the stream reader to read the data from the httpwebresponse
        Dim stream_reader As System.IO.StreamReader = New System.IO.StreamReader(the_response.GetResponseStream())
        'defining a string to stream reader fisnished streaming
        Dim code As String = stream_reader.ReadToEnd
        'haha here we use the regex
        Dim expression As New System.Text.RegularExpressions.Regex("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,4}")
        'adding the proxies to the listbox
        Dim mtac As MatchCollection = expression.Matches(code)
        For Each itemcode As Match In mtac
            ListBox1.Items.Add(itemcode)
        Next
After the first button we will see the second button which save.
   If ListBox1.Items.Count = (0) Then
            MessageBox.Show("Please click grab to grab proxies and then try saving", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Else
            'defining a streamwriter
            Dim S_W As IO.StreamWriter
            'converting listbox items to string
            Dim itms() As String = {ListBox1.Items.ToString}
            ''defining a savefiledialog
            Dim save As New SaveFileDialog
            Dim it As Integer
            save.FileName = "Grabbed Proxies"
            save.Filter = "Grabbed Proxies (*.txt)|*.txt|ALL Files (*.*)|*.*"
            save.CheckPathExists = True
            save.ShowDialog(Me)
            S_W = New IO.StreamWriter(save.FileName)
            For it = 0 To ListBox1.Items.Count - 1
                S_W.WriteLine(ListBox1.Items.Item(it))
            Next
            S_W.Close()
        End If
At last we need to add a line of code to clear the listbox which is
        ListBox1.Items.Clear()

Finally debug your program and test test .. How To Make A Proxy Grabber In VB.NET
YAY it's working ,I have explained the code by commenting over the codes and i hope this is helpful . thanks

The Types Of Message Boxes In C#

I am sorry guys , i have so many problems nowadays so I cannot concentrate on blogging, by the way I came through some forums posts and I really wanted to write something so today you will be learning the Types of Message Boxes in C# and the same types of Message Boxes are available in VB.NET .

What is a Message Box?
Shortly I can say Message Boxes are used to show Messages/Alerts to the user.

What are the types of Message Boxes?
The types of Message Boxes are something very important, if you want to display a message box you should know what is the type of the Message Box is going to be(ie:if you display "Cannot Convert" then that's a Error Message.
  1. Error Message Boxes.
  2. Information/Detail Message Boxes.
  3. Warning Message Boxes.
  4. Empty Message Boxes.
  5. Questioning Message Boxes.
  6. Exception Message Boxes.
Note : There are difference between Exception and Error .

Error : Error is something that stops the system from doing it or else we can say something that does not allow doing it.

Exception : Problems that occur during the run of a program or during the usage of a function or a statement.

Influence Theme - Dark Theme For VB.NET

influence theme
I have been using this Influence theme from a little longer time and it's really impressive than other themes. I hope you will like this theme .

10 Misconceptions of Microsoft SharePoint

Microsoft SharePoint has been around since 2001 and is currently being used by almost 80 percent of Fortune 500 companies, but there are still a lot of misconceptions going around about how it works. It's time to clear those up. In the following infographic which can also be found here, are 10 misconceptions about SharePoint and the truth behind them.

1. "SharePoint doesn't run on Macs and iPads." Actually it works just fine with Office for Macs. Alternatively, with Office Web Apps, you can use your iPad browser to view and edit documents with no extra installations.
2. "SharePoint should be managed by IT." While, yes, IT should monitor SharePoint, it is made to be managed by the business and driven by the users. It's not just a tool for techies.
3. "SharePoint is easy, just install it and see the benefits." While it's not difficult to learn to use it, you and your team will need a plan and training to get the most out of it.
4. "SharePoint is only a glorified file store." That is a part of what SharePoint has to offer, but it does more than just store and manage files. Investigate further to see what else you can do with it.
5. "SharePoint is for collaboration, not for running critical LOB systems." You can absolutely integrate your LOB systems on SharePoint's network. It even has the architecture to allow you to host third-party applications.
6. "It always looks like SharePoint." If you're worried about getting stuck with an unoriginal design, don't be. SharePoint 2013 makes it even easier to incorporate your corporate style into different-looking websites. Many websites use SharePoint and you can't even tell just by looking at it.
7. "Our IT department can install it." Your IT department could handle the default installation, but for a full scale deployment, you'll want a team of experts to figure out the best method.
8. "SharePoint shouldn't need custom development." There is a lot of functionality built right into SharePoint, but you'll want to add small custom developments to bring out the biggest benefits.
9. "Everyone's using it so we should." Don't just jump on the bandwagon before determining if it's right for your team. Sometimes specialist products are actually the best option to save money long-term.
10. "SharePoint is a one-off project." It may start out as a project, but it's intended to be used consistently with your business, growing and adapting along with your business needs. The more you keep working with it, the more you find it really pays off.
With a clearer understanding of SharePoint and its benefits, you can now use it more confidently and efficiently. If you hear any of these misconceptions being shared as truth, you now also have the knowledge to correct them.

Brought to you by Evokeit.com.

How To Read And Write Registry In C#

We will see how to read and write registry in c# today .
For people who don't know about registry if i tell it on my own words registry is like a registrar(the person who registers marriage) it registers all the software's that you install so it's like a registrar .


How to read registry ?
Actually reading a registry key is a simple and can be done with 3-4 lines of codes.I am doing this in Graphical User Interface program yes a Windows Forms Project . Add the namespace using Microsoft.Win32; now make sure what you want to read and where you want to read(Local Machine,Current User,etc) , I have no idea what to read so i will read a Google Chrome Extension registered here Google > Chrome > Extensions > dmibjfmphcpfoacbchialfobiohmhged 
How To Read And Write Registry In C#
So as you can see the path in registry now i write 3 lines of codes to read the registry key path(the path of the extension) and show it in a Message Box .
    RegistryKey path = Registry.LocalMachine.OpenSubKey("Software\\Google\\Chrome\\Extensions\\dmibjfmphcpfoacbchialfobiohmhged");//path of the registry
            string read = (string)path.GetValue("path");//creating a string to get the value of 'path'
            MessageBox.Show(read,"Registry Key Value", MessageBoxButtons.OK,MessageBoxIcon.Information);//the messagebox pops with the key 'path' value
I am sorry i couldn't explain everything in the code , as you can see in the first line we define where our key is  "Local Machine" you can put anything places as in your registry for that by the way remember when you read or write registry you should use double // for the destination .

Now when i debug here the Message Box pops up with the 'path' value.
How To Read And Write Registry In C#
Done with reading .

How to write registry?
As it's very easy to read registry , it's easy to write registry by the way i can't write my key into the path i read because it Google's so i chose Current User path to write the registry key. As we did before (reading) add the namespace using Microsoft.Win32; now i will create a registry path and i will add a value called , my whole path is HKEY_CURRENT_USER\Software\Shim\Ultimate_programming_tutorials . ok now i will write the code to write the registry key.
RegistryKey set = Registry.CurrentUser.CreateSubKey("Software\\Shim\\Ultimate_programming_tutorials");//setting the path
            set.SetValue("website", "http://ultimateprogrammingtutorials.blogspot.com");//setting the value
            MessageBox.Show("Value has been added " + set,"Value Added",MessageBoxButtons.OK,MessageBoxIcon.Information);//creating a messagebox to show it's added(value)
            set.Close();//closing the current process
website is the name of the value we are setting and http://ultimateprogrammingtutorials.blogspot.com is the value of work :).

Now when i debug a Message Box pops up saying value has been added and the path that the value was added.
How To Read And Write Registry In C#
Now when i look the path , the value is there .
How To Read And Write Registry In C#
Done with writing :) . I hope this is very useful :)

How To Set .NET Framework Target For VB.NET and C# Projects

I heard that many people don't know how to change the .NET Framework target in their projects or they don't know why their programs don't work on others pc who don't have the .NET Framework that you use  so i wanted to write an article about changing the Framework so , i think everyone should target their .NET Framework to the older version because not everyone have the latest .NET Framework ; i always target my Framework to .NET 2.0 because most of the people have .NET Framework 2.0 . There is a small problem in changing your .NET Framework , if you use any latest libraries or maybe algorithms that are not compatible with older versions of .NET Framework then when you change the Framework Target it will show lots of error . I will come to the point now changing the .NET Framework is easy by the way i would like to say that it's better to change the .NET Framework target when you just started the project and don't think to change the .NET Framework in the middle of your project or in a finished project because there is a chance of your project getting corrupted .