Hi, To convert any VB code to c# this link is very usefull: //www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx well C#conversion of your VB code will be following: [System.Runtime.InteropServices.DllImport("GDI32")] private static extern OLE_COLOR GetPixel(long hDC, long XCord, long YCord); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetWindowDC(long hwnd); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long ReleaseDC(long hwnd, long hDC); [System.Runtime.InteropServices.DllImport("USER32")] private static extern long GetDesktopWindow();
Nidhi s
Posts
-
need to convert some VB variable into C# -
dataview sort is not working.If you have Spaces in your field names or Reserved words then you have to put field name in [] to get it to work.I think it should work like this: DataView dv = ds.Tables[0].DefaultView; dv.Sort = "[AVG_VALUE]DESC";
-
Dynamically created Validation controlsI have dynamically created the textboxes .Now I want to add a Requiredfield validator with a txtbox. I am trying like this: TextBox txtBoxReEnterPassword = new TextBox(); ---Some other Code---- RequiredFieldValidator rfldValidator = new RequiredFieldValidator(); rfldValidator.Text = "Enter same Password"; rfldValidator.ID = "compvaldtor"; rfldValidator.ErrorMessage = "Enter Password"; rfldValidator.ControlToValidate = "txtReEnterPassword"; txtBoxReEnterPassword.Controls.Add(rfldValidator); But it's not working.
-
Count specified characterhi You can try this string str="ABC.ABC.ABC"; string[] strSplited=str.split('.'); If you don't have dot in end of string then int NoOfDots=strSplited.length-1; otherwise int NoOfDots=strSplited.length;
-
ques: what does a dataset returns ?If No rows in dataset it will return a empty table. Accessing the dataset table: ds.Tables[0]; ds.Tables[0].Rows[index][columnName];