June 29, 2017

Removing row header in datagrid

Look for a RowHeadersVisible property on the DataGridView in the designer.

RowHeadersVisible property set to false

June 28, 2017

How to use a Web Service in Windows Form Application


Introduction

Hi, Friends this article describes how to Communicate with a web service in Windows Form application.

Creating the client application

Step 1:
Create a Windows Form Application and design your form as in the following screen.

 
Step 2:
Add a web reference to the Application

Go to Solution Explorer then select the solution then click on "Add Service Reference". it will open an window

Then click on Advanced button on that window.




 Step 3:
 A new window will open. then click on "Add Web Reference". 
 
Step 4:
 A new window will open. Then within the URL type the service reference path.



(For example: http://localhost:XXXXX/WebServiceSample/yourservicename.asmx) then click on the "Go" button.
 

Change the web reference name from "localhost" to any other name as myservice

Click on the "Add Reference" button. It will create a Proxy at the client side.


Step 5: 
Now go to the cs code and add a reference for the Service.

 Write the following code.

myservice.Label_Printing obj = new myservice.Label_Printing();
obj.Url = System.Configuration.ConfigurationManager.AppSettings["mysampleapplication"];
obj.UserAuthenticate(txtUserId.Text, txtPwd.Text);

DataSet ds = obj.UserAuthenticate(txtUserId.Text, txtPwd.Text); 


Step 6:

Now go to app.congifig file and add the following code