Posts

Showing posts with the label C#

What is OOPS?

Object Oriented Programming (OOP) is a programming structure where programs are organized around objects and data.  

How to implement Folder Browser Dialogbox (FolderBrowserDialog) in c#

C# Code: string folder=””; using ( FolderBrowserDialog dialog = new FolderBrowserDialog ()) {     dialog.Description = "Open a folder which contains your files”;     dialog.ShowNewFolderButton = false ;     dialog.RootFolder = Environment . SpecialFolder .MyComputer;     if (dialog.ShowDialog() == DialogResult .OK)     {         folder = dialog.SelectedPath;       } }

How to implement open filedialogbox in c#

C# Code: String ImagePath=””; OpenFileDialog OpenFileDialog1 = new OpenFileDialog (); OpenFileDialog1.InitialDirectory = Convert .ToString( Environment . SpecialFolder .MyDocuments); OpenFileDialog1.Filter = "(*.png)|*.png|All Files (*.*)|*.*" ; OpenFileDialog1.FilterIndex = 1; if (OpenFileDialog1.ShowDialog() == DialogResult .OK) {     ImagePath= OpenFileDialog1.FileName; }

How to get Filename with extension from path in c#

C# Code: string   FilePath = "D:\\images\\1.png" ; string Extention = Path .GetFileName(FilePath);

How to get only File extension from path in c#

C# Code: string   FilePath = "D:\\images\\1.png" ; string Extention = Path .GetExtension(FilePath);

How to get Filename without extension from path in c#

C # Code: string   FilePath = "D:\\images\\1.png" ; string Filename = Path .GetFileNameWithoutExtension(FilePath);

How to resizeImage and save using c#.Net

C# Code: private Bitmap SetResizeImage( string strImg, string FileName, int Imagewidth, int ImageHeight) {     int nnx = Imagewidth;     int nny = ImageHeight;     System.Drawing. Image img = System.Drawing. Image .FromFile(strImg);     Bitmap cpy = null ;     cpy = new Bitmap (nnx, nny);     using ( Graphics gr = Graphics .FromImage(cpy))     {         gr.Clear( Color .Transparent);         gr.InterpolationMode = System.Drawing.Drawing2D. InterpolationMode .High;         gr.DrawImage(img, new Rectangle (0, 0, nnx, nny), new Rectangle (0, 0, img.Width, img.Height), GraphicsUnit .Pixel);     }    return cpy; } -----------------------------------------------------------------------------------------------...

How to insert a list (Data) in google spreadsheet in c# ?

Image
Before coding, create uri for your spreadsheet, see below setpes: 1.login to google drive and open your spreadsheet 2.Download spreadsheet through (File -> Dowanload as -> Webpage) then new page will be oped

How to use DataPager control with Data List View in asp.net c#

Image
UI:

File decryption using c#.net

c# code:             string   InputFile =   Application .StartupPath + "\\ encrptsofttechsolving.xml " ;     // this is excel file, i.e I  wanna to deencrypt                   string   OutputFile = =   Application .StartupPath + "\\softtechsolving.xls " ;     // softtechsolving is file name after decryption of   encrptsofttechsolving.xml             XmlDocument XDoc1 = new XmlDocument ();             try             {                 string password = @"xxxxxxx" ; // Your Key Here             ...

File encryption using c#.net

try             {                 string InputFile = Application .StartupPath + "\\softtechsolving.xls" ;   // this is excel file, i.e I  wanna to encrypt                 string OutputFile = = Application .StartupPath + "\\encrptsofttechsolving.xml" ;   // encrptsofttechsolving is file name after encryption file name                                                                           ...

How to send mail to another email id through gmail provider using c#.net

C# Code: MailMessage Msg = new MailMessage ();             // Sender e-mail address.             string FromMail = "noreplysofttechsolving@gmail.com" ;             string Password = "xxxxxx" ; //sender email password             Msg.From = new MailAddress (FromMail);             // Recipient e-mail address..              string  ToMail = txtEmail.Text;             Msg.To.Add(ToMail);             string MsgBody = "Thank you!!!!" ;             AlternateView htmlMsgView = AlternateView .Create...

How to send mail to another email id using C#.Net

C# Code: MailMessage Msg = new MailMessage ();         string FromMail = "noreply@softtechsolving.com" ;         string Password = "XXXXXXX" ;   //”XXXXXX” is email id password         Msg.From = new MailAddress (FromMail);         // Recipient e-mail address..         string ToMail = txtEmail.Text;         Msg.To.Add(ToMail);         string MsgBody = "welcome to softtechsolving…" ;         AlternateView htmlMsgView = AlternateView .CreateAlternateViewFromString(MsgBody, null , MediaTypeNames . Text .Html);         Msg.AlternateViews.Add(htmlMsgView);         Msg.Subject = "softtechsolving" ; ...

How to send mail to another email id with attachment file

C# Code: Attachment at = new Attachment (Server.MapPath(MemberPic)); //for attached file.... 'MemberPic' is file path , is string format…                     MailMessage Msg = new MailMessage ();                     string FromMail = "support@softtechsolving.com" ;                     string Password = "XXXXXX" ;  // "XXXXXX" is sender password…                     Msg.From = new MailAddress (FromMail);                     // Recipient e-mail address..       ...

How to Send message to mobile no using c#

c# Code: string ContactNo = "8343094272" ; // to mobile no                  string MessageText = "Welcome to Softtechsolving" ; // your message                 string strUrl = string .Format( "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=softtechsolving@gmail.com:soft@123&senderID=TEST SMS&receipientno={0}&msgtxt={1}&state=4" , ContactNo, MessageText);                 WebRequest request = HttpWebRequest.Create(strUrl);                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();                 Stream s = ( Stream )response.GetResponseStream();  ...