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

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

VB.net - MRU List trouble

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :Windows Application
Hi, I have a form with a Menu Strip that has an Open and Recent Files menu. When I open a document, it appears in the Recent files menu but disapears when I close the application. How do I keep this information from clearing? Also, how do I keep duplicates from being added to this list? For  example, if I open the same document twice, it appears in the menu twice. Thanks, Imports Excel = Microsoft.Office.Interop.Excel Imports System.IO Imports System.Diagnostics Public Class Form1 Inherits System.Windows.Forms.Form Private Sub OpenToolStripMenuItem_Click(ByVal sender _ As System.Object, _ ByVal e As System.EventArgs) _ Handles OpenToolStripMenuItem.Click Dim ofd As New OpenFileDialog ofd = New System.Windows.Forms.OpenFileDialog() ofd.Filter = "Excel Workbook (*.xlsx)|*.xlsx|" & "All files|*.*" ofd.InitialDirectory = IO.Path.GetDirectoryName("C:\program files\Noxious Weeds Report\Reports\") ofd.FileName = IO.Path.GetFileName("C:\program files\Noxious Weeds Report\Reports\") If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then Dim xlApp As Excel.Application Dim xlWorkBook As Excel.Workbook xlApp = New Excel.ApplicationClass xlWorkBook = xlApp.Workbooks.Open(ofd.FileName) xlApp.Visible = True AddToRecents(ofd.FileName) End If End Sub Private Sub

View Complete Post

More Related Resource Links

Trouble using GetListItemFields to pull data from List

First, a summary of what I am trying to do: - I want to use a workflow to create a new site automatically when a user adds a row to the List called "Registry". They choose a title and a Template, I want to take this information and use it in the workflow to create a new site. -So far I am able to create a new site when a row is added, but I cannot incorporate the info that the user entered. Below is the code that I am using inside OnWorkflowActivated to access the "Title" and "Template" fields that the user is entering in the "Registry" List. Any help would be greatly appreciated. Also included is a link to the GetListItemFeilds info page.   http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getlistitemfields.aspx ***I only have localhost there for privacy reasons***   private void onWorkflowActivated(object sender, ExternalDataEventArgs e) { SPSite site = new SPSite("http://localhost"); SPWeb web = site.OpenWeb(); string itemURL = "/Lists/Registry/AllItems.aspx"; try { string[] itemFields= { "LinkTitle", "Template" }; SPListItem item = web.GetListItemFields(itemURL, itemFields); foreach (string fieldName in itemFields) Console.WriteLine("{0} = {1}", fieldName, item[fieldName]); } catch (NullReferenceException nre) {

Simple binding trouble with a list box


Dear all,

I inherite from a code of a collegue who left the company and I get some troule with a binding in it.

I have a list box binding which is define has follow :

              x:Name="lbScheduler" Grid.Row="0"

As you can see from code above, there is a binding to ItemSource, but in code I could not find any datacontext set. This is the first thing.
Then if I add items to the list box trough a  button dircetly from user interface whihc does lblScheduler.Items.Add(...), then I can see the item correctly display in the listbox.

But during the running of the application, when clicking on a particular buton, some asynchrone process happen which in fact take the list of items in this listbox and then store that list in database.

What it happenning is that right after pressing that button, my list box gets empty and my previous items desapears .

Then right after the button click even, I simply add the following code :

  lbScheduler = _ListBoxSchedulerHelper.

trouble moving list to another site in collection


I am trying to use the process for moving a list to another site: http://blog.henryong.com/2008/01/21/how-to-movemigrate-sharepoint-list-itemsdocuments-and-preserve-metadata-properties-at-the-same-time/at-the-same-time .

I get this error:

An error was encountered performing this operation.


Operation to Move 'Remove scroller in lower right corner' to '/sites/itd/SBTD/Lists/Website Requests' Failed
No items were moved. Please remove Remove scroller in lower right corner from the selection and retry operation

Can anyone tell me what went wrong.  Could not find referece to this error.  What scroller are they talking about?

There are no mistakes; every result tells you something of value about what your are trying to accomplish.

Trouble getting List item from timer job


I wrote an SP timer job that runs as a web application.  In my Execute method I'm trying to get an item and evaluate for a certain field.


SPWebApplication webApp = this.Parent as SPWebApplication;
SPContentDatabase contentDb = webApp.ContentDatabases[targetInstanceId];
SPList myList = contentDb.Sites["http://DEVmos

Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

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.

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

Compare List


i have got two list<string> containing datas

i would like to compare the both list and the result to new list whch does not contains the same data.(basically unique data)

eg shown below..

list A       list b          list c

a             a                 d

b           d                    c

c            f                   e

f            e

plz let me knw..

Gridview with a dropdown list for editing


Hello. I am working through Scott Mitchell's ASP.Net in 24 hours book. I am finishing the photo album project.

I have a GridView that retrieves a list of uploaded photo rows for the logged-in user.
The GridView is for editing and deleting rows.

The photo Category field in the Gridview is a dropdown list. The text entry field was deleted after converting this field to a Template.

Like the uploaded photos, these Categories are user-specific. They are created in another web page.

Users also have the option to select "none" for the category when they upload an image.

For the GridView:  The Category ID field's ItemTemplate and EditItemTemplate both have a " - None - " choice added to them.

I am getting this error:

'pictureReadOnlyCategories' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value


Note: The ID for the ItemTemplate for that dropdown list is the ID listed above in the error: "pictureReadOnlyCategories".


Am I missing some step in this process of changing a GridViews text field to a dropdown that can be used for editing? I went through the book's instructions three times.

Here is my code for the dropdown list and a screenshot of the Design

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


Trouble with UpdateProgress showing...


Recently I converted a project to VS.NET2010 and ASP.NET 4.0 (not convinced this is the problem, but regardless this is when the problem began) and now I am having an issue with an AJAX UpdateProgress showing. Here is the abrriviated code:

   <asp:UpdatePanel ID="UpdatePanelPostPageLoad" runat="server">
         <asp:Timer ID="tmrPostPageLoad" Enabled="false" Interval="100" OnTick="PostPageLoad_LoadData"
         <asp:Timer ID="tmrPostPageLoadPt2" Enabled="false" Interval="1" OnTick="PostPageLoad_LoadDataPt2"
         <%--Placing the UpdateProgress inside the UpdatePanel targeted--%>
         <asp:UpdateProgress ID="UpdateProgressPostPageLoad" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanelPostPageLoad">
                       Updating blah blah....


Populating Dropdown List using FK


Hi Folks,

2 Questions. I am trying out Data Entities in VWD 2010 Express. I have a parent (Customers) and child (Orders) table. Customers table has FirstName, LastName and Email columns.

Q1. When I view/edit/insert an Order, it shows the customer's first name in dropdown list whereas I want the full name. How can this be done?

Q2. How can I change the default behavior of PK/FK relationship so that customer's Email is displayed instead of Name?

Any help will be much appreciated.


C#, LINQ: (List<>) Question???


Hi Everyone,

I have a strange problem:


There is an entity (Table) called "Filters" in my .edmx which has all my tables and stuff in it (to use it for LINQ queries)

I have created a class called "CustomFilters" which inherits "Filters". So now my cutom class has all the properties of the original "Filters" class (table) and 1 more additional property that i wanted which is a List of "CustomFilters":

List<CustomFilters> children = new List<CustomFilters>();

Now i get all my records into:

List<CustomFilters> theOriginalList = new List<CustomFilters>();

NOTE: first all records are tken into a List<Filters> and then these are added into List<CustomFilters> where List<CustomFilters> for children of that record is added, and then children of the child records, and so on......

so now, every record is an instance of CustomFilters which has a property named "children" which is a list again; and each child again has instanaces of "CustomFilters", and each instance again has children...and on and on and on.....

(basiacally its a data source for a treeview in my silverlight control)

every thing is good and working as expected.


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