.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

Set Formula Programmatically

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :ASP.Net
Hi there!We have one requirement where we need to set the formula programmatically. For example, the general formula is c = a + b. After a few months, they would want that the formula would be c = a * b.Can this be done via front end? If so how?

View Complete Post

More Related Resource Links

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Creating an Excel Spreadsheet programmatically using VB.NET

The Interoperability services make it very easy to work with COM Capable Applications such as Word and Excel. This article reveals using Excel from a managed application. Excel is the spreadsheet component of Microsoft Office 2000. The majority of Excel programmatic functionality is exposed through Automation via the type library Excel9.olb. The intention of this article is to express that a managed application can interrelate with Excel as a COM server.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

How to programmatically add controls to Windows forms at run time by using Visual C#

Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:

using the linqDataSource control programmatically (dynamically)



my scenario is this: I want to use the linqDataSource control to bind data to a gridview for it's efficient built-in paging and sorting features *but* I don't want the data to be bound until the user has input various search parameters, so I need to bind the data from a button click event. Also, the search options will be somewhat complex in that there will be several optional search parameters, via various dropdowns and textboxes, so I can't just declaratively/statically setup all the WHERE parameters on the linqDataSource (at least I'm assuming I can't, or that it may result in poor performance if I do and just assign default values like the everything wildcard '%' for the cases the user doesn't use a particular search parameter). Given that brief description, here is an example of what I'm doing, but with only one WHERE parameter for simplicity, the real code will be adding anywhere from 1 to about 12 WHERE parameters depending on how the user sets the search options in the GUI.

the linqDataSource on the aspx page:

<asp:LinqDataSource ID="ldsMain" runat="server" 
        Select="new (field1, field2, field3, etc..)" 

How to insert Image (jpeg) into MS Word Programmatically using VB.NET


Hi there,

Can someone help me on How to insert Image (jpeg) into MS Word Programmatically using VB.NET..not C#.NET??? Sad

I could hardly find any articles for the coding. Preferably using Bookmark...can i have the sample code.



Advanced Basics: Set Word Document Properties Programmatically


At the beginning of another lovely day of writing courseware in mad pursuit of unrealistic deadlines, I received a frantic call from a business partner. He was at the end of a long consulting project and had several hundred Microsoft® Word documents, all of which required their document properties to be set identically, except the Title property of the document, which was to be based on the document file name, minus the .

Ken Getz

MSDN Magazine March 2006

Win32 Resources: Using C++ to Programmatically Retrieve a Global Cursor's Shape and ID


Getting global cursor information is useful when developing software that drives or gathers information about other UI-based applications, including information about a remote machine. This article describes a way to programmatically identify the current cursor's ID and bitmap at any point in time. The first technique described is based on polling for information and shows how to get the handle of the current global cursor. This handle will then allow you to get information about the cursor. You can also monitor WinEvents for changes to the global cursor.

Dmitri Klementiev

MSDN Magazine October 2001

formula to display all combination output


hi all

i am now think of how to get all the output for all the combinations


given : 1234

output = 1234,1243,2143......and so on.....all 24 possible output

if given : 123

output = all 12 output

if given 12345 , all 120 output...

can someone provide me the algorithm or formula for that ?


Programmatically Simulating the ListView's ItemCommand Event


I have a User Control that contains a ListView.  In the user control's code is this event handler:

    protected void listView1_ItemCommand(object source, ListViewCommandEventArgs e)
      Button_ClickHandler(source, e);

What's occurring is that I'm explicitly firing an event so that the parent web page can monitor this and take appropriate actions.  Thus when the user clicks on a different ListViewItem it triggers the population of associated data elsewhere on the web page.

This all works fine except for one thing: When I first load the control I'm pre-setting the first ListViewItem.  Unfortunately, just setting the ListView's SelectedIndex = 0 doesn't fire the aforementioned event handler.

So I started investigating how to call "listView1_ItemCommand" but couldn't figure out how to instantiate the "e" parameter.

Any ideas of how to resolve this?


Creating Reorderlist Programmatically


I hope to get some guidance on how to create reorder lists programmatically because of the situation described below. Thank you.

I have a page where I want to have a toDo Iist for each of several (typically 10) milestone categories. I can think of 3 options.

I don't know in advance how many 'active' categories there will be but I there is a known fixed total of about 20  categories, of which from 1 to 20 may be 'active'

1. Have one Master ReOrderList And Then Nest the Category ReorderLists Inside 

2. Create the reorderlists programmatically.

3. Brute force approach. Hardcode all 20 reorderlists and their associated sqldatasources, and then set visibility

depending on which category is active. This approach is the simplest but has the disadvantage of too much

repetitive code and the reorder lists would be in a fixed order, when I really want them to match the category order.




Trying to set update panel trigger programmatically


 I have a recursive sub that finds a dropdown list and sets up an AsyncPostbackTrigger for an update panel. I have tried calling this sub both from page_init and page_load 

If the dropdownlist is within the update panel, eveything works fine. If the dropdown list is not in the updatepanel I get error

A control with ID 'ddlPersonFilter' could not be found for the trigger in UpdatePanel 'up1'. In both cases the sub does find the dropdown list and executes the code to set up the trigger. Thanks for your help.

    Private Sub SetUpdatePanelTrigger(ByVal oControl As Control)
        For Each ctrl As Control In oControl.Controls
            If TypeOf ctrl Is DropDownList Then
                If CType(ctrl, DropDownList).ID = "ddlPersonFilter" Then
                    Dim thisddl As New DropDownList
                    Dim thistrigger As New AsyncPostBackTrigger
                    thisddl = ctrl
                    thistrigger.EventName = "SelectedIndexChanged"
                    thistrigger.ControlID = thisddl.ID
                    Exit Sub
                End If
                If ctrl.HasControls Then
                End If
            End If

Programmatically create an InfoPath form


I'm programmatically creating an InfoPath form using this article: http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm.


Everything works well up to 29 fields (my:field1 ... my:field29). After that it runs without an error and posts a form to the library however the icon does not switch to an infopath icon and the filename stays blanks. I don't believe this field specific, it seems to be happening when I use any 29 to 30 fields so I'm thinking its a memory issue with the stream reader.

Has anybody every had this issue before, is there a way to fix this?


Programmatically retrieve data from the associated row in SharePoint and use the data to do math


I am trying to pull all of the associated data from a SharePoint list row to an InfoPath form repeating table.  I would like to select 1 unique value from the row and have the other fields auto-populate with the associated data from that row. 


SharePoint Columns and also names of InfoPath fields 1, 2, 3, 4, 5, 6, 7.

I have a dropdown that is connected to column 1 and I would like to select 1 and have it populate the rest of the fields from that row.  I am currently doing this with information and C# code from:  http://www.bizsupportonline.net/infopath2007/sharepoint-list-retrieve-value-same-row-repeating-table-infopath

Adding client event handlers to an ASP.NET controls programmatically



I want to add client event handlers to ASP.NET controls (For example: GridView/Button ) programmatically to ASP.NET.

I am aware of "onclick" event handler, so my code would be

GridView1.Attributes.Add("onclick", "JSGridViewFunction()");

Button1.Attributes.Add("onclick", "JSButtonFunction()");

I want to know what are all the event handlers that are available for (or that can be added to)  ASP.NET controls.

For example, I want to add "onsort" event handler to ASP.NET GridView control.

But the following code fails

GridView1.Attributes.Add("onsort", "JSGridViewFunction()");

Please help.


Programmatically Changing the Profile Provider at Runtime


Dear All

I'm using one application but have multiple providers in my web.config for memberships, roles and profiles to allow my application to be used by different groups of users who need to connect to different databases.

This means I'm having to change the membership, role and profile providers on-the-fly in my code-behind files. So far I've taken care of the membership and roles a bit like this:

Dim RolePV As RoleProvider = Roles.Providers(GetSettingFromFile("Provider"))

However, I'm having trouble finding out how to do the same sort of thing for Profiles. I've looked at ProfileProvider and ProfileManager but I can't work it out how to access my the profile property that I've created in my web.config file called "ScreenSize". Normally you would just write Profile.ScreenSize to read or write to the property.

Please can you help me to understand how I access the profile property called ScreenSize by dynamically setting the profile provider first?

I'd be very grateful for any help or advice.

Many thanks



Programmatically delete a .webpart file from wpcatalogs folder from an IIS website


We are using a third party wsp in our solution which directly adds the web parts into the web application store rather than the web part gallery(References to them are present in IIS site's wpcatalog directory). We want to remove these web part files so that the users will not be able to add these web parts to pages directly. Or any other modification so that users will not be able to add these directly. Is there a way we can do this programmatically?

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