Wednesday, 20 November 2013

How to get Listview subitems index

if (listview1.SelectedItems.Count > 0)
{
                int icolcount = 0; string  sID = "";
                foreach (ColumnHeader header in listview1.Columns)
                {  
                    if (header.Text.ToLower().Trim() == "id")
                    {
                        sID= listview1.SelectedItems[0].SubItems[icolcount].Text;
                        break;
                    }
                    icolcount ++;
                }
}

Saturday, 16 November 2013

How to change Listview subitem back color

How to change the backcolor of a listview subitem using its own value

ListViewItem newlist= new ListViewItem( "Item 1");
newlist.SubItems.Add( "Color" );
newlist.SubItems[1].BackColor = Color.FromArgb( -16711936 );
newlist.UseItemStyleForSubItems = false;

listView1.Items.Add( newlist);

A free, cross-platform browser-based IDE (ASP.NET work online)

CodeRun Studio is a free service

CodeRun Studio is a cross-platform Integrated Development Environment (IDE), designed for the cloud. It enables you to easily develop, debug and deploy web applications using your browser.
CodeRun Studio can be used instead or alongside your existing desktop IDE. You can upload existing code in order to test it in the cloud or for sharing with your peers.

Friday, 8 November 2013

Avoid confirmation box in MsiExec uninstall



MsiExec.exe /I{A52EEC0E-D0B7-4345-A0FF-574804C7B78A} /passive

{A52EEC0E-D0B7-4345-A0FF-574804C7B78A} --> is Product Code
 
If you want to completely hide the UI, use the /quiet (நீங்கள் முற்றிலும் UI மறைக்க விரும்பினால்)

switch instead of /passive.


Example C#

            Process p = new Process();
            p.StartInfo.FileName = "msiexec.exe";
            p.StartInfo.Arguments = "/x {A52EEC0E-D0B7-4345-A0FF-574804C7B78A} /passive";
            p.Start();

OR

            Process p = new Process();
            p.StartInfo.FileName = "msiexec.exe";
            p.StartInfo.Arguments = "/x {A52EEC0E-D0B7-4345-A0FF-574804C7B78A} /quiet";
            p.Start();

             Process p = new Process();
            p.StartInfo.FileName = "msiexec.exe";
            p.StartInfo.Arguments = "/qn /x {A52EEC0E-D0B7-4345-A0FF-574804C7B78A}";
            p.Start();

Saturday, 14 September 2013

Color to RGB and hex Value

HexConverter
 
DialogResult result = colorDialog1.ShowDialog();
if (result == DialogResult.OK)
{
    Color c=colorDialog1.Color;
    string HexConverter= "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
}

RGBConverter

DialogResult result = colorDialog1.ShowDialog();
if (result == DialogResult.OK)
{
    Color c=colorDialog1.Color;
    string HexConverter= "RGB(" + c.R.ToString() + "," + c.G.ToString() + "," + c.B.ToString() + ")";
}

Tuesday, 10 September 2013

C# array null/empty string values

String[] URL= {"1","2","","4","6",""};

var temp = new List<string>();
foreach (var s in URL)
{
         if (!string.IsNullOrEmpty(s))
         {
              temp.Add(s);
}
URL = temp.ToArray();