Tuesday, August 5, 2014

Passing a Form to a function C# .Net

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    class Class1
    {


        public static void GetForm(Form frm)
        {
            frm.Text = "Satsara";
        }


        public static void SetLabel(Form frm, string lng)
        {
            string ename = "Name";
            string bname = "Nama";
            string name;
            if (lng == "EN")
            {
                name = ename;
            }
            else
                name = bname;

            Control ctn = frm.Controls["lblName"];
            ctn.Text = name;
        }

    }
}

calling the method

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Class1.GetForm(this);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Class1.SetLabel(this, "EN");
        }

        private void button2_Click(object sender, EventArgs e)
        {

            Class1.SetLabel(this, "BA");
        }
    }

Find component by Name in C#

        string ename = "Name";
        string bname = "Nama";

        private void button1_Click(object sender, EventArgs e)
        {

          Control ctn = this.Controls["lblName"];
           ctn.Text = ename;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Control ctn = this.Controls["lblName"];
            ctn.Text = bname;
        }
}

Sunday, August 3, 2014

HTTP Error 404.3 - Not Found/ Web service problems


HTTP Error 404.3 - Not Found


 The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.



Open Control Panel

  Programs\Turn Windows Features on or off

    Internet Information Services

      World Wide Web Services

        Application development Features

          ASP.Net <-- check mark here



Then run the “C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe” in CMD admin mode

 

C:\> C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis –ir

C:\> C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -i

Postgress - Read a XML file from a postgress table XML column

SELECT xmltable.* FROM xmldata, XMLTABLE('//ROWS/ROW' PASSING data COLUMNS id int PATH ...