locked
Object reference not set to an instance of an object error.

    Question

  • i've installed the VSeWSS.msi on VS 2005, i'm using SPS 2007, i'm developing on my workstation in C#, i've added the Mircosoft.Sharepointserver dll reference to my project but i still can't deploy a very basic webpart. i get the "Object reference not set to an instance of an object" error but there's no reference to a line, column, project or anyhting. very frustrating. any suggestions/links whould be appreciated.
    Thursday, February 08, 2007 7:03 AM

Answers

  • Hello everyone.  There are few threads around about this issue.  I put in a case with Microsoft Support a few weeks ago and here is the conclusion I received.  Good luck getting ahold of a support person now.  Waiting times are 40 business hours (yes, that's two weeks).  Edit -- I'm reflecting on this and don't know how I thought that 40 hours was two weeks (maybe 5 hours a day?), but please also look at my final post and see that there are alternatives to using the templates (ddf files with mscab, Andrew Connell's post on SharePoint project structures, the Ted Pattison Group's STSDev and SPDeploy by Clint Simon -- also keep looking for more tools from the SPDeploy creator under the name of SPTools which encompasses remote deployment, enhanced WSS web services, productivity tools and more.  Enjoy!  http://www.ascentium.com/blog/sp/Post29.aspx)

     

    Hi George,

     

    It was my pleasure to serve you during your “err when deploying webpart thru VSE "Object reference not set to an instance of an object” issue. I hope that you were delighted with the service provided to you. If you ever have any questions please feel free to call me. My contact information is below.

     

    Since we have addressed the issue this case was created for, and have received confirmation from you, I have closed the case with ID# SRX070424XXXXX

     

    I am providing you with a summary of the key points of the case for your records.

     

    PROBLEM:

    ========

    Deploying webpart to SharePoint 2007 using  Visual Studio Extensions for Windows SharePoint Services (VSE WSS) and getting error message “Object reference not set to an instance of an object”.

     

    RESOLUTION:

    ===========

    1] Copy the built webpart.dll to c:\windows\assembly (GAC)

     

    2]  In the folder location where webpart VSE solution was created found setup.bat file in bin\Debug, and this is the file which VSE calls when deploying the solution and has instructions to run it. Ran the setup.bat from command prompt as “setup /uninstall” this ran ok, then ran setup /install this ran ok too. Modified the setup.bat file and add the line to remove the webpart.dll from the GAC and add the webpart.dll assembly to GAC as under:

     

    under :LDeploy section before goto :EOF added the following line:

    ===========================================================

    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if webpartTest.dll

    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf webpartTest

     

    Thanks for your time and patience in this matter. 

    Thank You,

    Wednesday, May 30, 2007 8:05 PM
  • I already had this problem, and spent a lot of time trying to discover where were the problem.

     

    I just discovered that my SQL Server was out of disk space. By resizing it, solved my problem.

     

    Soo, take a look in your sql server and verify the disk space. My webpart have show this problem when I tryed to deploy, because it returned me no errors while trying to compile.

     

     

    Friday, January 28, 2011 12:42 PM

All replies

  • When developing with VSeWSS.msi you need to work directly on the server.

    There are several build events that call STSADM.exe to deploy solutions etc.

    Being locally on the server also makes step-by-step debugging easy (bind worker process)

    Also (unfortunately) this is the recommended setup from MS.

    hth

    AndersR

    Thursday, February 08, 2007 7:46 AM
  • Same problem here

    I used to be able to compile without problem and sudenly I get this same error

    Friday, February 23, 2007 5:58 AM
  • Im having the same problem. Is the only solution to also install the whole SPS 2007 environment on your workstation or is there an other solution?
    Monday, February 26, 2007 8:37 AM
  • You could set up a dev environment in VPC 2007. It's a free download and it'll probably save you heaps of configuration time in the long run.
    Monday, February 26, 2007 12:53 PM
  • I am getting the exact same thing and I am running everything on the same server.  It's very frustrating as I had a version of the application working but all of a sudden I am unable to deploy it or test it and my client, understandably, is starting to get angry.
    Tuesday, March 06, 2007 10:51 PM
  • I have the same problem. I can build and deploy a solution once from the VSeWSS templates. After that i get the error. I've noticed it's not building the wsp file necessary for solution deployment (if you go look at the datestamp on the .wsp file, you'll see it's not changing on each failed deployment).

    This behavior just started one day out of nowhere, and it drives me nuts. It's too bad because that made life a lot easier for debugging web parts.

    What i've done to keep things a little automated is to create a few external tools that run stsadm.exe with the appropriate arguments to add, upgrade, retract etc., which i can run from within VS2005 at least. Before doing that though, you still need to build your wsp file using makecab.exe, so it's still not a very automated process and is a big pain to debug.

    perhaps this problem will get fixed. Thus far my complaints about it have been met with "you really shouldn't be using VSeWSS."
    Tuesday, April 24, 2007 12:27 AM
  • Same problem here.
    Wednesday, April 25, 2007 3:01 PM
  • same here
    Wednesday, April 25, 2007 9:29 PM
  • i found something that works for me... i ignored the error and built the project anyway, copied the dll from the debug dir to the bin in sps, strong named it and allowed partially trusted calls and bingo, my sps website allowed me to import my very basic webpart.

    now all i need to do is work out how to do the above in vb.net (my preferred lang) and i'll be mildly happy
    Thursday, April 26, 2007 12:38 AM
  • I removed From the top of my web part and it worked!!!!

    XmlRoot(Namespace = "namespace")

     

     

    Thursday, April 26, 2007 1:24 AM
  • I have same error. But in 1st time i can add my webpart to the page. But then, when i make some changes on my web part, i can't see them on page.
    And ALL time i get this error "Object reference not set to an instance of an object error. Line 0 Column 0"

    Please help..
    Thursday, April 26, 2007 3:02 PM
  • I have the same exact problem, anyone have the solution ????
    Wednesday, May 30, 2007 7:09 PM
  • Hello everyone.  There are few threads around about this issue.  I put in a case with Microsoft Support a few weeks ago and here is the conclusion I received.  Good luck getting ahold of a support person now.  Waiting times are 40 business hours (yes, that's two weeks).  Edit -- I'm reflecting on this and don't know how I thought that 40 hours was two weeks (maybe 5 hours a day?), but please also look at my final post and see that there are alternatives to using the templates (ddf files with mscab, Andrew Connell's post on SharePoint project structures, the Ted Pattison Group's STSDev and SPDeploy by Clint Simon -- also keep looking for more tools from the SPDeploy creator under the name of SPTools which encompasses remote deployment, enhanced WSS web services, productivity tools and more.  Enjoy!  http://www.ascentium.com/blog/sp/Post29.aspx)

     

    Hi George,

     

    It was my pleasure to serve you during your “err when deploying webpart thru VSE "Object reference not set to an instance of an object” issue. I hope that you were delighted with the service provided to you. If you ever have any questions please feel free to call me. My contact information is below.

     

    Since we have addressed the issue this case was created for, and have received confirmation from you, I have closed the case with ID# SRX070424XXXXX

     

    I am providing you with a summary of the key points of the case for your records.

     

    PROBLEM:

    ========

    Deploying webpart to SharePoint 2007 using  Visual Studio Extensions for Windows SharePoint Services (VSE WSS) and getting error message “Object reference not set to an instance of an object”.

     

    RESOLUTION:

    ===========

    1] Copy the built webpart.dll to c:\windows\assembly (GAC)

     

    2]  In the folder location where webpart VSE solution was created found setup.bat file in bin\Debug, and this is the file which VSE calls when deploying the solution and has instructions to run it. Ran the setup.bat from command prompt as “setup /uninstall” this ran ok, then ran setup /install this ran ok too. Modified the setup.bat file and add the line to remove the webpart.dll from the GAC and add the webpart.dll assembly to GAC as under:

     

    under :LDeploy section before goto :EOF added the following line:

    ===========================================================

    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if webpartTest.dll

    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf webpartTest

     

    Thanks for your time and patience in this matter. 

    Thank You,

    Wednesday, May 30, 2007 8:05 PM
  • Thanks George for saving me 40 hours of waiting time and my hair as I don't have to pull any more out.

     

    Jon Herschel

    Wednesday, May 30, 2007 8:11 PM
  • Hey George - I just noticed the 2 lines that support got you to add around Gac-ing and re-Gacing,
    you'll want to swap those lines.

    As the section of code you've snippeted it the LDeploy
    gacutil /if ....  = force install
    gacutil /u ....  = uninstall

    So when you run the lines as the deploy section exists your beloved *.dll will NOT be Gac-ed.
    I cant see anywhere else in the Setup.BAT where there is a Gac-ing step.

    Cheers,

    Mick.
    Thursday, May 31, 2007 12:42 PM
  • Great, thanks for pointing this out Mick.  I have just been using Run -> assembly to drag and drop for the most part.  Let's also clarify something else while we are at it.  I beleive the only time that you need to redeploy a web part is when you change one of the xmls.  If you are just changing the code you can just reinstall in the GAC and do an iisreset.  Either with the command line or dragging and dropping.  Also, if you deploy the webpart as a solution, in release mode, you can activate it to any site collection.  To do this you can go to Central Administration -> Global Configuration -> Solution management -> Click on you webpart solution -> Deploy or Retract Solution.
    Thursday, May 31, 2007 2:24 PM
  • Can you help me step by step.. I dont really understand how you are doing it.

     

    I can deploy at the moment my webpart only to 1 subsite.. any others give me the error, I dont know why, tried with a simple new webpart and same thing happen.. and I can only deploy to the same subsite.

    Thursday, May 31, 2007 7:49 PM
  • Can you help me step by step.. I dont really understand how you are doing it.

     

    I can deploy at the moment my webpart only to 1 subsite.. any others give me the error, I dont know why, tried with a simple new webpart and same thing happen.. and I can only deploy to the same subsite

    Thursday, May 31, 2007 7:50 PM
  • Hi Fred,

    Here are the steps:

    Create a new web part project in Visual Studio. 

    Before you build, go to project properties and set the location to your server, ie http://localhost.

    Change the build mode to release.

    Build the project and it should work the first time, but not on builds after.

    Go to Central Administration -> Global Configuration -> Solution management -> Click on you webpart solution -> Deploy or Retract Solution

    You should be able to deploy your solution to a Site Collection.

    When you go to the site collection it should be available to add.

    If not go to Site Actions -> Site Settings -> WebParts -> New

    Check to see if you part is in the list.  If it is check the checkbox and click Populate Gallery.

    Let me know how far you get with this and if you have any problems let me know.

    Thursday, May 31, 2007 8:34 PM
  • Ok.. mabye its not a VS problem afterall... I just rewrote completly a webpart only to show "Hi" and work so far.. here the step I did

     

    Create new project -> WebPart

    Just added the writer.write("Hi"); in the Render

    Was trying what u told so build first release... but didnt knew where to go for your next step, so I rebuilded it in debug

    And then was able to add it to my differents page without problems and the usually error that appear...

     

    Mabye it was the code of my webpart but I dont understand since it was working of a site. And the problem only began when I tried to add it to another... mabye I just changed a little something but since then nothing work... I will copy/paste my code here.. u can take a look if u want

     

     

    using System;

    using System.Runtime.InteropServices;

    using System.Web.UI;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Serialization;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.WebControls;

    using Microsoft.SharePoint.WebPartPages;

    using System.Web.UI.HtmlControls;

    using Microsoft.SharePoint.Utilities;

    using System.ComponentModel;

    using System.Web.UI.WebControls;

    namespace ListWebPart

    {

    [Guid("977513a1-4a9f-4885-bae1-facd013a02e1")]

    public class ListWebPart : System.Web.UI.WebControls.WebParts.WebPart

    {

    private SPSite mySite;

    private SPGridView myGridView;

    private SPList myList;

    private SPDataSource mySPDS;

    private SPWeb myWeb;

    protected DVDropDownList myDropDownList;

    protected HtmlInputText myText;

    protected HtmlButton myButtonOk;

    public ListWebPart()

    {

    this.ExportMode = WebPartExportMode.All;

    }

    private void myDropDownList_Load(object sender, EventArgs e)

    {

    if (myDropDownList.Items.Count == 0)

    {

    using (myWeb = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context))

    {

    string listitems = "";

    foreach (SPList list in myWeb.Lists)

    {

    listitems = list.Title;

    myDropDownList.Items.Add(listitems);

    }

    }

    }

    myDropDownList.AutoPostBack = false;

    }

    public void myButtonOk_click(object senter, EventArgs e)

    {

    myText.Value = myDropDownList.SelectedValue.ToString();

    }

    protected override void CreateChildControls()

    {

    myDropDownList = new DVDropDownList();

    myDropDownList.Load += new EventHandler(myDropDownList_Load);

    Controls.Add(myDropDownList);

    myButtonOk = new HtmlButton();

    myButtonOk.InnerText = "Validation";

    myButtonOk.ServerClick += new EventHandler(myButtonOk_click);

    Controls.Add(myButtonOk);

    myText = new HtmlInputText();

    myText.Disabled = true;

    myText.Value = "";

    Controls.Add(myText);

     

    }

    protected override void Render(HtmlTextWriter writer)

    {

    myWeb = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);

    string linksHtml = "";

    foreach (SPList list in myWeb.Lists)

    {

    string listLink = "<a href='" + list.DefaultView.Url.ToString() + "'>" + list.Title + "</a>(<b>" + list.Items.Count + "</b>)<br>";

    linksHtml += listLink;

    }

    writer.Write(linksHtml);

    myDropDownList.RenderControl(writer);

    myButtonOk.RenderControl(writer);

    writer.Write("<br>");

    myText.RenderControl(writer);

    }

    }

    }

    Thursday, May 31, 2007 9:15 PM
  • Hmmm....I went down the same path and copied my code from the web part that was having the issue to a brand new one and still got the error.   Actually it looks like I am getting the error no matter which web part I use now. =(

     

     

    Friday, June 22, 2007 1:13 PM
  • Me too, I had fix the problem for some time, stopped webpart devloppement, did some other stuff and yesterday needed to do a new one and had that problem all day and dont remember how I solve it last time. Tried everything, opened all link that google gave me for 6 pages and nothing fixed it. Changed to install file to remove the webpart before redeploying it again but change nothing, removed the dll in the GAC and the file in TEMPLATE\FEATURE but still get the error after I build it once. First time is fine but then after I  get that error no matter what I do
    Friday, June 22, 2007 1:31 PM
  • Hi Fred,

    Still having problems?  Does anyone know how to edit the project type?  If you change the install file and have it do something that you can easily detect I think you will see that it doesn't even run.  This makes me think that it is in the project type itself?  Has anyone checked for updated extensions floating around somewhere?

    Wednesday, June 27, 2007 3:11 AM
  • I am in the process of starting a community WSSWiki and one of the first articles I have posted on there is to resolve the "Object reference not set to an instance of an object" issue with the Visual Studio Extensions for WSS (VSeWSS).

     

    Try the solution out and let me know if it works for you as it did for me (this is unsupported by Microsoft, so please do not do this in your production environment):

     

    http://www.wsswiki.com/Visual_Studio_Extensions_For_WSS_3.0

     

    Thank you,

     

    Paul Liebrand

    http://www.wsswiki.com

     

    Wednesday, June 27, 2007 6:07 AM
  • Hey Paul,

     

    thanks for your post, it helped me a lot. This "object reference not set to an instance..." error gave me quite a headache for the last week so I really appreciate your WiKi. Now I am able to deploy my WebParts again. (I get the "object reference ..." thing now while adding the WebPart to the site, but I think that is an other issue).

     

    Thank you very much,

     

    Malte Nawroth

     

     

    Wednesday, June 27, 2007 9:01 PM
  • Installing the feature I uninstaled last time worked for me Smile Before playing with that feature everything was working fine. Thanks to Paul, I found out that this feature id was still in the content database (and not in the features folder anymore).
    Monday, July 16, 2007 1:36 PM
  •  

    I was also having this problem.   It was caused by (I think) developing on a web farm.     When deploying, the feature is copied to the 12\template\feature directory.  However in your debug Start Browser Url,  you are pointing to the farm DNS entry. 

    VseWss copies to the feature folder on your dev server and then uses that debug Url to.... (for some reason)   but hits the load balancer that then redirects to a different machine than what you are working on and (gasp / gag) It can't find the feature you just deployed because it is on your development server.  

     

    I solved this by adding a DNS entry that just points to the dev server, updated the Debug Url (what a hack that is) for the new entry and added the entry to Alternate Access Mappings in Central Admin / opertaions.   

     

    Such an easy solution that took 2 days to figure out.   Paul is correct in that it is something tosted with the features / database but there are probably a few ways that it can get messed up.   We need that utility that tells us what is in the 12/template/features (on each server) and what is in the database and the diff between.   

     

     

    Hope this helps someone else.  

    Monday, July 16, 2007 9:18 PM
  • I did develop a utility that I used to find my missing features. You can find that utility here http://wsswiki.com/Visual_Studio_Extensions_For_WSS_3.0

     

    There is nothing special about this utility. It basically compares what is in your database to what is in the features directory of the 12 hive.

     

    Thanks,

     

    Paul Liebrand

    Monday, August 27, 2007 2:56 PM
  •  

    I was getting an error "Object reference not set to an instance of an object error. Line 0 Column 0" because I did not have port number specified in the “Start browser with URL field” in the debug tab under project properties (Changed it from http://SPMACHINE to http://SPMACHINE:80). You will have to specify port specific to your application.

    As soon as I did that everything worked fine.

     Hope this will help.

    Thursday, September 06, 2007 6:48 PM
  • I know this sounds stupid .. but are you initialising all of your objects in the Constructor or in CreateChildControls ?

     

    Web Parts follow standard web page postback rules .. so your objects need to be initialised each time the page refreshes!

    Thursday, September 06, 2007 7:48 PM
  • Follow the following steps that will help you to get rid of the problem you are facing

     

    1. Go to central administration page of your server
    2. Go to Operations tab
    3. Then under "Global Configuration" Open "Solution Management"
    4. You will find a list of web parts you have deployed to different Sites, here.
    5. Now from a list of web parts click the one you want to remove or deploy again.
    6. Then on the next screen, click on the "Retract Solution" on the top bar.
    7. then on next screen choose when you want to retract/remove the solution or say your web part and from which site from the last dropdown on that page
    8. once you hit ok button, then you will come back to the same page where all your web parts/solutions are listed
    9. now refresh your screen twice or thrice and you will notice that the status of your web part will become " Not Deployed"
    10. now go back to your VS 2005 and do your deloyment again, you will get an exception or an error message again but this will let you work with your changes you have made.

    This may not be the correct solution but will help you to get rid of the problem.

     

    Mark this as an answer if it helps.

     

     

    Monday, September 10, 2007 6:40 AM
  •  

    Full props to Paul Liebrand, his tool finds the rogue feature and you snuff it out with a bit of SQL:

     

    DELETE FROM dbo.Features
    WHERE FeatureId = '[missing feature GUID]'

     

    Crazy.

    Sunday, September 16, 2007 12:31 PM
  •  

    Check your event log. if you find that you dont have enough rights for the share point database, you may get this object reference error. its funny but happened with me.

    happy coding

    Monday, October 01, 2007 7:46 PM
  • Tried your advice but doesn't work

    Any more ideas?

     

    Tuesday, November 13, 2007 11:39 PM
  • So rote, are you getting the "Object reference not set to an instance of an object" error?

     

    Are you using version 1.0 of VSeWSS or the 1.1 CTP?

     

    Have you tried:

     

    Wednesday, November 14, 2007 8:16 AM
  • Not really sure of the version'm using...
    Is there a new versiob out there?

     

    Wednesday, November 14, 2007 11:32 AM
  •  

    There's the August CTP (v1.1) - http://www.microsoft.com/downloads/details.aspx?familyid=3e1dcccd-1cca-433a-bb4d-97b96bf7ab63&displaylang=en - but according to Thomas Carpe, "Of course, this issue was not fixed in the CTP version of the VSeWSS v1.1 released in August."

    Wednesday, November 14, 2007 11:53 PM
  • Problem in my case that ID that I was using was did not have access to Sharepoint Portal SQL database. I guess when the SDK gets deployed, it must be doing something in SQL db and since ID I was using did not have access and gave me this error. So make sure you use the same ID that you used to install visual studio and sharepoint.

     

    Tuesday, November 20, 2007 9:35 PM
  • Which ID are you talking about?

    PLease be more sprcific ican't remember any ID when installing VS and sharepoint

    Wednesday, November 21, 2007 12:06 AM
  • I am talking about AD ID used to install visual studio and sharepoint 2007 - btw this is dev server  (since both shold not be on  same machine to deploy webpart). I used same ID to install both but when I switch to another ID ( regular user id even though i was admin on that box) did not work and gave me this error. Look at id used .. must be specified in your central admin . service account id you used to install sharepoint 2007. Let me know if this works or not.

    Wednesday, November 21, 2007 1:07 AM
  • visual studio and sharepoint  *must be* on same server to do "deploy"
    Wednesday, November 21, 2007 1:10 AM
  • Its in the same server Sad
    The only way iget through this is doing it through the console Smile
    Which means it isn't automated.
    I don't know this is happening it use to be ok before and may people are compaling about it.
    When are they going to *FIX* it

    Wednesday, November 21, 2007 1:21 AM
  • A lot of SP developers have started building their own project structures and using MSBuild to create the wsp file instead of using the projects in the SDK.  This has so many advantages.  It does require knowledge of manifest and element files, but you can use your existing ones.  There is also a tool called SPDeploy by Clint Simon that will build, deploy, recycle, etc. 

     

    Here are some links that you should check out:

     

    Andrew Connell's post with an awesome walkthrough:

    http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx

     

    The anatomy of a WSS project in VS:

    http://sharepointsolutions.blogspot.com/2006/10/anatomy-of-sharepoint-wss-v3-feature.html

     

    And SPDeploy:

    http://www.spsimon.com/2007/09/introducing-spdeploy.html

     

     

     

    Thursday, December 06, 2007 4:24 AM
  •  

    It seems all you guys have this problem while using web parts. I got the same issue with aspx pages.

     

    First I create a web application, then upload the aspx file to some folder, copy dll file to the bin folder. It worked well in the past, and it even works well for other web apps. Suddenly my app crashed when I try to delploy a new version . When I debug on the server, I found one dropdownlist control has not been initialized in the page load event.

     

    Btw, the same aspx file and dll file work on other servers.

    Thursday, May 15, 2008 9:44 AM
  • I found the root of the problem. It has to do with permissions. I came to this conclusion after reading the following post http://www.novolocus.com/2008/10/20/stsadm-error-object-not-set-set-to-an-instance-of-an-object/

    Then, I found that I was not an "update farm administrator". This is found under Central Administration / Operations / Security Configuration / Update farm administrators's group

    After adding myself to the list, I was able to deploy without problems
    • Proposed as answer by Luis Botero Monday, January 12, 2009 8:32 PM
    Monday, January 12, 2009 8:10 PM
  • Hi,


       I'm getting the same error while deploying the usercontrol through in smartpart in sharepoint.I checked out my coding a lots it was perfect.Could you please help me out.
    Monday, July 20, 2009 5:14 AM
  • I did face same problem, but then I started Visual Studio As Administrator on my Windows 2008 server and then deployed, everything worked.
    Krishnaa
    • Proposed as answer by Nick McCready Tuesday, November 17, 2009 6:30 PM
    Monday, November 09, 2009 6:31 AM
  • I did the same with out reading this, and it completely solved the issue. 
    Tuesday, November 17, 2009 6:31 PM
  • Hi

    if this happens when feature is activated this means that your code uses SPcontext while on activation there is no context :P

    Cheers

    Mohamed Hachem


    Momo
    Wednesday, July 07, 2010 2:34 PM
  • When  can debugg the code it will give the error "Object reference not set to an instance of an object.".

    The code is--

     

     

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using SMC.AlphaAccounting.EntryControls;
    using SMC.AlphaAccounting.PlugIns;
    using SMC.PlugInContracts;
    using SMC.BusinessObjects;
    using SMC.Utils;
    using SMC;
    using SMC.AlphaAccounting;
    using SMC.AlphaAccounting.DataEntry;
    using Infragistics.Win.UltraWinEditors;
    using Infragistics.Win.UltraWinMaskedEdit;
    using Infragistics.Win.UltraWinToolbars;

    namespace WindowsApplication3
    {
        public partial class FormCountry : SmcDataEntry
        {
            private boGlChart boLocalGlChart;
            private boVendors boLocalVendors;
            public FormCountry()
            {
                InitializeComponent();




                this.ultraNumericUniqueID.KeyDown += new KeyEventHandler(ultraNumericUniqueID_KeyDown);
                this.ultraNumericUniqueID.KeyPress += new KeyPressEventHandler(ultraNumericUniqueID_KeyPress);
                this.ultraMaskedISOCode.KeyPress +=new KeyPressEventHandler(ultraMaskedISOCode_KeyPress);
                this.ultraMaskedISOCode.KeyDown +=new KeyEventHandler(ultraMaskedISOCode_KeyDown);
                this.ultraMaskedAlphaCode.KeyPress +=new KeyPressEventHandler(ultraMaskedAlphaCode_KeyPress);
                this.ultraMaskedAlphaCode.KeyDown +=new KeyEventHandler(ultraMaskedAlphaCode_KeyDown);
                this.ultraNumericNumCode.KeyPress +=new KeyPressEventHandler(ultraNumericNumCode_KeyPress);
                this.ultraNumericNumCode.KeyDown +=new KeyEventHandler(ultraNumericNumCode_KeyDown);
                this.ultraMaskedName.KeyPress +=new KeyPressEventHandler(ultraMaskedName_KeyPress);
                this.ultraMaskedName.KeyDown +=new KeyEventHandler(ultraMaskedName_KeyDown);
                this.ultraMaskedContinent.KeyDown += new KeyEventHandler(ultraMaskedContinent_KeyDown);
                this.ultraMaskedContinent.KeyPress += new KeyPressEventHandler(ultraMaskedContinent_KeyPress);
            }

            void ultraMaskedContinent_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedContinent_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

           

            void ultraMaskedName_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedName_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraNumericNumCode_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraNumericNumCode_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedAlphaCode_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedAlphaCode_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedISOCode_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraMaskedISOCode_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraNumericUniqueID_KeyPress(object sender, KeyPressEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }

            void ultraNumericUniqueID_KeyDown(object sender, KeyEventArgs e)
            {
                //throw new Exception("The method or operation is not implemented.");
            }


          

            private void FormCountry_Load(object sender, EventArgs e)
            {
                //Title = GeneralRoutines.SmcFileTitle(SmcFileNumber.COUNTRY);
                //StatusBar.Panels["Name"].Text = "Country";
                //DisplayVersionNumber("COUNTRY.DLL");
                DataBindEntryControls();


                if (BusinessObject != null)
                {
                    boLocalGlChart = new boGlChart(BusinessObject.AlphaDatabaseManager, BusinessObject.LogFile, BusinessObject.VirtualDatabase);
                    boLocalGlChart.InitISmcBusinessObject(BusinessObject.AlphaDatabaseManager, BusinessObject.LogFile, BusinessObject.VirtualDatabase);
                    boLocalVendors = new boVendors(BusinessObject.AlphaDatabaseManager, BusinessObject.LogFile, BusinessObject.VirtualDatabase);
                    boLocalVendors.InitISmcBusinessObject(BusinessObject.AlphaDatabaseManager, BusinessObject.LogFile, BusinessObject.VirtualDatabase);
                }
                 
            }
            private void DataBindEntryControls()           
            {
                string sTable = _localDataSet.Tables[0].TableName;
                _bindingManagerBase = this.BindingContext[_localDataSet, sTable];
                ultraNumericUniqueID.DataBindings.Add("Text", _localDataSet, sTable + ".UNIQUEID");
                ultraMaskedISOCode.DataBindings.Add("Text", _localDataSet, sTable + ".ISO_CODE");
                ultraMaskedAlphaCode.DataBindings.Add("Text", _localDataSet, sTable + ".ALPHA_CODE");
                ultraNumericNumCode.DataBindings.Add("Text", _localDataSet, sTable + ".NUMERIC_CODE");
                ultraMaskedName.DataBindings.Add("Text", _localDataSet, sTable + ".NAME");
                ultraMaskedContinent.DataBindings.Add("Text", _localDataSet, sTable + ".CONTINENT");

            }

            private void UniqueID_TextChanged(object sender, EventArgs e)
            {

            }

            private void toolbarManager_ToolClick(object sender, ToolClickEventArgs e)
            {
                   SmcDataEntry DataEntry = new SmcDataEntry();              
                    InsertRecord();



               
            }

            private void ultraMaskedISOCode_MaskChanged(object sender, MaskChangedEventArgs e)
            {

            }

            private void ultraGroupBox1_Click(object sender, EventArgs e)
            {

            }

            private void ultraNumericUniqueID_ValueChanged(object sender, EventArgs e)
            {

            }

            private void ultraMaskedContinent_ItemNotInList(object sender,
                Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs evArgs)
            {
                if (!(String.IsNullOrEmpty(ultraMaskedContinent.Text)))
                    ultraComboEditorContinent_BadInput();
            }

            private void ultraComboEditorContinent_BadInput()
            {
                MessageBox.Show("Please select a status from the drop-down list.");
                ultraMaskedContinent.Focus();
            }
           
          
        }
    }

     

    Thanx in advance.....

    Monday, September 06, 2010 7:02 AM
  • I already had this problem, and spent a lot of time trying to discover where were the problem.

     

    I just discovered that my SQL Server was out of disk space. By resizing it, solved my problem.

     

    Soo, take a look in your sql server and verify the disk space. My webpart have show this problem when I tryed to deploy, because it returned me no errors while trying to compile.

     

     

    Friday, January 28, 2011 12:42 PM