.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Call to "ChooseFont" API function fails

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :.NET Framework
Hi all, I'm trying to call ChooseFont function in order to load standard system font dialog instead of .NET FontDialog (which does not support not TrueType fonts and fails with error if I try to choose such font). In C program there no problem to call to this function, but in C# the call fails with CDERR_STRUCTSIZE code (returned by call to CommDlgExtendedError). All structures sizes are equal to those in C declarations. Here is a code (maybe I miss something). Thank you in advance. private const int CF_SCREENFONTS = 0x00000001; private const int CF_EFFECTS = 0x00000100; private const int CF_INITTOLOGFONTSTRUCT = 0x00000040; [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct LOGFONT { public int lfHeight; public int lfWidth; public int lfEscapement; public int lfOrientation; public int lfWeight; public byte lfItalic; public byte lfUnderline; public byte lfStrikeOut; public byte lfCharSet; public byte lfOutPrecision; public byte lfClipPrecision; public byte lfQuality; public byte lfPitchAndFamily; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = LF_FACESIZE)] public string lfFaceName; } //structure size in C is equal to 60, so I use int instead of IntPtr [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private struct CHOOSEFONT { public int lStructSize; public int hwndOwne

View Complete Post

More Related Resource Links

databind from a custom function call


in datalist templatefield, i want to bind an imagebutton's visible property. the scenario is .. it is a picture comments page like one in facebook. if its your own comment, the delete button is shown, otherwise not.  the problem is .. for the imagebutton i want to set visible = false, if the user logged in is the same user as the one who commented. how can i do that ? please help

currently im using this code on datalist databind event. but the label is returned as null

public bool set_visibility()
        Label lb = DataList3.FindControl("Label7") as Label;

        if (lb.Text == Session["user_id"].ToString())
            return true;
            return false;

findcontrol dosent return the control.

how to call thickbox function in codebehind



i want to call thickbox.js function in codebehind , below the code in jquery

i want to call below code in codebehind

function tb_remove() {
    if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
        $("body","html").css({height: "auto", width: "auto"});
    document.onkeydown = "";
    document.onkeyup = "";
    return false;

Call function Vb in ASP

Does anyone know if is possible fill one column using a function in VB ? I thought in something like this but I don't know what i put in one part. Thanks.   <Columns> <asp:TemplateField HeaderText = "A" > <HeaderTemplate> <table> <tr> <td>Teste</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <asp:Label ID="lblTeste" runat="server" Text='<%# ???????? %>' /> </ItemTemplate> </asp:TemplateField>  

SSRS 2005 SP3 - Instr function with Global Variable fails in Subscriptions

Hi I have a very simple expression in a text box in my report:  INSTR(Globals!ReportServerUrl,"Report").  This expression should return the integer value of where the string "Report" appears in the Global variable for the ReportServerUrl.  Simple enough.  This works fine for generating the report directly through report manager, and in my case returns a value of 20. However when run as a subscription and emailed to myself the value returned is 0. This suggests that the search string does not appear in the Global variable. In the reportserver config file the URLroot tag contains the correct server address - http://myserver/reportserver. Does anyone know why i should be experiencing this issue with my subscriptions?  Your help would be much appreciated! Thanks Guy  Guy

Can you call a javascript function from code behind?

Call you cal a javascript function from the code behind? If so how??? 

Can you call Javascript function from the codebehind?

 Can you call Javascript function from the codebehind?  How???

Cannot call Table Valued Function from Dynamic stored procedure statement

Hello,  I have a table-valued function that splits string into a table column. I can easily call this function from a stored procedure within a regular SELECT statement: SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM [dbo].[fnSplitValues](@Code2String))   However when I try to use the same logic for a dynamic SELECT statement: ‘SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM ' + [dbo].[fnSplitValues](@Code2String) + ')’ I get an error ‘Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnSplitValues", or the name is ambiguous.’ Any idea what is wrong with my dynamic SQL?   Please help, Lana

java script to call serverside function

hi i want java script by which i can call my asp.net (vb) function which i have written in aspx.vbi just using the vb function to change and check value of hiddenfild and other controln dont want to use ajax control toolkit , i wat to perform some action after spefic time interval

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

How to call javascript function in master page

helloi have javascript file 'script.js' where i have writt en a function for print. but this function is working fine if i am not using master page in my report page but the question is i want to use master page for my report page where i am calling javascript function but it is not working . Do help me regarding MasterPage and Javascript function.

asp:Button inside a SharePoint Dataview's Rows with onclick event does not call C# function. Pull i

asp:Button inside SharePoint Dataview Rows with onclick event does not call C# function. Pull it out of Dataview and works fine. I have a ASP.NET Button I've placed inside a SharePoint  DataView's rows with an onclick event pointing to C# function block inside my page. The page refreshes when I click on them, but it's not hitting that code block. If I move the button to outside the dataview and make the ID fixed, the code works beautifully. what's up with that? the button in the Dataview: td class="ms-vb" style="width: 70px"><asp:Button runat="server" Text="Delete" id="Delete{@ID}" CommandArgument="{@FileRef}" OnClick="DeleteDoc"/> </td> my C# onclick handler (inline C# on the page) void DeleteDoc(object sender, EventArgs e) { Button b = sender as Button; .. more code The buttons are rendered and they look like this: input type="submit" name="ctl00$PlaceHolderMain$g_08acadfd_957b_4112_a426_cc7c81991c1e$Delete1" value="Delete" id="ctl00_PlaceHolderMain_g_08acadfd_957b_4112_a426_cc7c81991c1e_Delete1" Thie code block in inline and I'm working from SharePoint Designer. Not sure how I can troubleshoot this.  Am I missing something here, maybe I need to add an Itemtemplate or something like we need to in the ASP.N

WCF function call in page load not working asynchronously

Hi all, I am trying to implement the WCF async function call in my page load event but, it not working asynchronously. Which means page content is displayed only after the asynchronous event is completed. This is my code         protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 ServiceReference1.Service1Client srv = new WebApplication1.ServiceReference1.Service1Client();                 srv.GetListCompleted += new EventHandler<WebApplication1.ServiceReference1.GetListCompletedEventArgs>(srv_GetListCompleted);                 srv.GetListAsync();             }         }           void srv_GetListCompleted(object sender, WebApplication1.ServiceReference1.GetListCompletedEventArgs e)         {         

The expression contains undefined function call MyUserFunction() error :Telerik Reports

  Hello All, I am getting the error."An error has occured while processing textbox:The expression contains undefined function call FormType()". I have a report..where in i used a user function called "FormType". My datasource  for teh report is sharepoint list. I am passing a parameter to the user function in the code.My user functions retrieves three values(one each time based on the conditions)But when i select the user function..in the edit expression dialog box.. i am not writing any parameter inside the user function as i am not sure what to write there. I have gone through http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx and thought i might fall in 2nd cateogry..but unable to find a solution for that Please help me. Here is the code. InitializeComponent();             string strType;             SPSite oSite = new SPSite("spsiteurl");             SPWeb oWeb = oSite.OpenWeb();             string[] parameters = { "10", "100", "1000" };             T

Asp.net MVC: How to call javascript function in Html.ActionLink

When I edit single recored in page, I use checkbox to get a selected row not every row with an actionlink element, but it seemed I cant make this way happen through calling javascript code(function GetSelectedRow() should return an id). Could anyone have a nice idea?<head runat="server"> <title>Index</title> <script type="text/javascript" language="javascript"> function GetSelectedRow() { var a = 0; var chkBoxes = document.getElementsByName("chkSelect"); var count = chkBoxes.length; for (var i = 0; i < count; i++) { if (chkBoxes[i].checked == true) a = chkBoxes[i].primaryKeyID; } return a; } </script> </head> <body> <div> <span style="width:20%"> <%: Html.ActionLink("Add", "Create")%> </span> <span> <%: Html.ActionLink("Edit", "Edit", new { id = GetSelectedRow()) %> </span> <span> <%: Html.ActionLink("Detial", "Details", new { id = GetSelectedRow() })%> </span> <span> <%: Html.ActionLink("Delete", "Delete", new { i

how to jquery call a other call function other class is not static

how to jquery call a other call function other class is not static[WebMethod]    public static bool Verify(string username, string password)    {        //Do your logic with username, password  here        //I am just checking with admin/admin credentials            Console.WriteLine("Ritu");        string s="SELECT p.RETMSG FROM P_DOCSHARE(1001,1453,'1002,1012,1011','Add') P";                 CCUtility c;                c=new CCUtility();             c.JavascriptMessage(c.Insert_P(s));        return (username == "admin" && password == "admin");    }

How to call Method/Function Programatically in c#

I have strange requirement.I want to call method programatically.If I pass the name of the method and Class as  string I should be able to invoke the method programaticallyEg  String MethodName = "SomeMothodName"; String ClassName = "SomeClassName";With this I shoud be able to do the followingSomeMothodName SMN = new SomeMothodName();SMN.SomeMothodName();So all i have is string of method name and class name. how can I invoke the method?Is it possible to do this?If some one knows please let me know.

Call a javascript function from.Net

Hi,I want to be able to open a new window using javascript.  I know how to do this when it's inline code but it's not too neat as the html built contains lots of reused data.Ideally what I would like to do is, register a function using .Net then call it from my code.  It doesn't help that I'm not too familiar with how to pass parameters to a javascript function in the first place.Anyone help?ThanksJohn
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend