I try to delete an item from recyclerview and from slqlite data base.  These are the activities:   1.The database  DatabaseHandler.java  public  void deleteTask(long position){     SQLiteDatabase db = this.getWritableDatabase();     db.delete(TABLE_TASKS, KEY_TASK_ID + "=" + position, null);     db.close(); }    The onBindViewHolder from TaskAdapter   TaskAdapter.java  @Override public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {     final Task stringTask = tasksList.get(position);     holder.taskText.setText(stringTask.getTaskName());     holder.dateText.setText(stringTask.getTaskDate());     holder.id = stringTask.getID();     holder.deleteButton.setOnClickListener(new View.OnClickListener(){         @Override         public void onClick(View view){              tasksList.remove(position);             notifyItemRemoved(position);              dth.deleteTask(stringTask.getID());           }     });  }   This is the error:   java.lang.NullPointerException: Attempt to invoke virtual method 'void com.example.android.todolistapp.DatabaseHandler.deleteTask(long)' on a null object reference at com.example.android.todolistapp.TaskAdapter$1.onClick(TaskAdapter.java:51) at android.view.View.performClick(View.java:6935) at android.widget.TextView.performClick(TextView.java:12738) at android.view.View$PerformClick.run(View.java:26211) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
129
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
22246
@AuraEnabled(cacheable=true) public static String  deleteContacts(List&lt;String&gt; contactIds) {     List&lt;Contact&gt; returnList = new List&lt;Contact&gt; ();     String query = ' SELECT Id,Name, LastName,Department,MobilePhone, Email FROM Contact WHERE id IN : contactIds ';     for (Contact thisContact:  Database.Query(query)) {          returnList.add(thisContact);     }     try {       delete returnList;       return'deleted successfully';     }     catch(Exception ex){        return 'Problem occoured';     }  }  JS Method deleteSelected(){     deleteContacts({         contactIds :this.selectedIds     })      .then(result =&gt; {         this.dispatchEvent(             new ShowToastEvent({                 title: 'Success',                 message: result,                 variant: 'success',             }),         );         return refreshApex(this.getContactList, { searchKeyWord: '$searchKeyWord' });     })     .catch(error =&gt; {         this.error = error;     });
40796
I am using GridView control in  2005  using .  How can I delete a particular row from GridView.  I have written the following code. But it's not working...  DataRow dr = dtPrf_Mstr.NewRow(); dtPrf_Mstr.Rows.Add(dr); GVGLCode.DataSource = dtPrf_Mstr; GVGLCode.DataBind();  int iCount = GVGLCode.Rows.Count; for (int i = 0; i &lt;= iCount; i++) {     GVGLCode.DeleteRow(i); } GVGLCode.DataBind();
45672
This question has been asked before, but none of the answers on those threads have helped so far.  Getting the following error when trying to deploy a test class from the sandbox to production in the Force.com IDE:  System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadPerson: execution of AfterInsert caused by: System.Exception: Too many SOQL queries: 101  LeadPerson trigger looks OK, e.g., no SOQL calls inside a loop.  trigger LeadPerson on Lead (after insert) {     Map&lt;Id, Lead&gt; leadMap = new Map&lt;Id, Lead&gt;();     Map&lt;String, Lead&gt; leadEmailMap = new Map&lt;String, Lead&gt;();      for(Lead lead : Trigger.new) {         if (lead.Email != null) {             leadMap.put(lead.Id, lead);             leadEmailMap.put(lead.Email, lead);         }     }      Map&lt;String, Person__c&gt; personMap = new Map&lt;String, Person__c&gt;();     for (Person__c p : [SELECT Id, Email__c FROM Person__c WHERE Email__c IN :leadEmailMap.keySet()]) {         personMap.put(p.Email__c, p);     }      List&lt;Person__c&gt; addPersons = new List&lt;Person__c&gt;();     List&lt;PersonHistory__c&gt; addPersonHistorys = new List&lt;PersonHistory__c&gt;();     List&lt;Lead&gt; addPersonLead = new List&lt;Lead&gt;();     Map&lt;String, String&gt; addPersonEmails = new Map&lt;String, String&gt;();      for(Lead lead : Trigger.new) {         if (lead.Email != null) {             if (personMap.containsKey(lead.Email)) {                 // Create PersonHistory__c record for existing Person__c records                 Person__c getPerson = personMap.get(lead.Email);                 PersonHistory__c newPersonHistory = new PersonHistory__c();                 newPersonHistory.Person__c = getPerson.Id;                 newPersonHistory.RecType__c = 'LEAD';                 newPersonHistory.RecSubType__c = lead.inq_type__c;                 newPersonHistory.SFID__c = lead.Id;                 newPersonHistory.RecTypeStatus__c = 'NEW';                 addPersonHistorys.add(newPersonHistory);             } else {                 // Create Person__c and PersonHistory__c record for NEW Person__c records                 String firstInitial = '';                 if (lead.FirstName != null) {                     firstInitial = lead.FirstName.substring(0, 1);                 }                  if (!addPersonEmails.containsKey(lead.Email)) {                     addPersonEmails.put(lead.Email, 'EMAIL');                     Person__c newPerson = new Person__c();                     newPerson.Email__c = lead.Email;                     newPerson.AltKey__c = firstInitial + lead.LastName + lead.PostalCode;                     newPerson.Current_Status__c = 'NEW';                     addPersons.add(newPerson);                     addPersonLead.add(lead);                 }             }         }     }      // INSERT NEW Person__c records     List&lt;Database.SaveResult&gt; newPersonResult = Database.Insert(addPersons);     for (integer i = 0; i &lt; newPersonResult.size(); i++) {         // Create PersonHistory__c records for new Person__c records         PersonHistory__c newPersonHistory = new PersonHistory__c();         newPersonHistory.Person__c = newPersonResult.get(i).getId();         newPersonHistory.RecType__c = 'LEAD';         newPersonHistory.RecSubType__c = addPersonLead.get(i).inq_type__c;         newPersonHistory.SFID__c = addPersonLead.get(i).Id;         newPersonHistory.RecTypeStatus__c = 'NEW';         addPersonHistorys.add(newPersonHistory);     }     insert addPersonHistorys; }   The debug log doesn't show a transaction having more than 5 out of 100 SOQL queries in the CUMULATIVE_LIMIT_USAGE sections. Not sure where to look next. Any help is appreciated.
89686
trigger quotepotential on Quote_Line_Item__c (after insert) {     list&lt;batch__c&gt; b=[select batch_value__c                        from batch__c                        order by batch_value__c DESC LIMIT 1];     if(!b.isempty()){         list&lt;Quote_Line_Item__c&gt; quotelineitem=new list&lt;Quote_Line_Item__c&gt;();         for(Quote_Line_Item__c quoteline:trigger.new){             quoteline.max_batch__c=b.batch_value__c;             quotelineitem.add(quoteline);         }     } }   Help me to find out get rid of this error
73868
I need help. I am currently trying to test this code before uploading  public class CoreValuesExt { ApexPages.StandardController sc; public boolean readonly {get; set;} public Core_Values__c cv {get; set;} public integer countEdit = 1; public string buttonValue {get; set;} public integer recordScan;  public CoreValuesExt(ApexPages.StandardController sc) {     this.sc = sc;     cv = new Core_Values__c();     cv.Account__c = sc.getid();      readonly = true;     buttonValue = 'Edit';     recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];    if (recordScan != 0){    cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];     }  }  public ApexPages.PageReference Save() {     return sc.Save(); }  public void ApplyAction() {     countEdit++;     Integer modolus = Math.mod(countEdit, 2);     String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;     if(modolus == 0)     {         readonly = false;         buttonValue = 'Save';     }     else     {         if(total != 'nullnullnullnullnullnull')            {         if (recordScan == 0){         insert cv;         readonly = true;         buttonValue = 'Edit';         }         else         {         update cv;         readonly = true;         buttonValue = 'Edit';         }         }     }    }   }  With this trigger.  trigger CoreValuesTrigger on Core_Values__c (before insert) {  Core_Values__c cvs = Trigger.new; CoreValuesExt.ApplyAction(cvs);  }   But when I try to save, I get a message saying:      Illegal assignment from List to   CoreValuesExt__Core_Values__c at line 3 column 1   "  How do I go through with this? I need help. Thanks
104197
When i create new User Account and login with that credentials, it gives me this problem if admin doesnt have set thier values yet !!!**  AllotmentList = [select id, Days_Remaining__c from PTO_Allotment__c where Year__c =:year and Employee__c=:EmployeeList[0].id LIMIT 100]; //access only Current user Allotment details                 //to handle Listoutof Bound Exception wrote if-else          if(AllotmentList.size()&gt;0)         {         requests.PTO_Allotment__c=AllotmentList[0].id;         requests.Days_Remaining__c=AllotmentList[0].Days_Remaining__c;         }         else         {             //write a code when AllotmentList is empty ....         }
36256
we are facing a serious issue. We have a batch APEX job running daily which makes updates on records fulfilling certain conditions. There is another job running parallel to this, in some cases updating or accessing to the same records than the batch job and hence, causing the error:     Update failed. First exception on row 400 with id XXX; first error:    UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record or 200    records:   So, I had then read that in order to fix this kind of error you should use FOR_UPDATE in your select statement (records that have to be updated). The problem is, that you can not use FOR UPDATE for batch jobs. We tested this and effectively, we get the error:     System.QueryException: Locking is implied for each batch execution and   therefore FOR UPDATE should not be specified      It will however lock the records within each execution of execute. See   QueryLocator.getQuery()usage:      You cannot use the FOR UPDATE keywords with a getQueryLocator query to   lock  a set of records. The start method automatically locks the set   of records in  the batch.   Could you find a solution to this?. We would like to handle this in the code itself, because we don't have the permission to schedule the batch job for another time as the another job.
119160
This Trigger is on lead (Before Insert, Before Update) and it errors (System.NullPointerException: Attempt to de-reference a null object). I'm getting this error when i'm posting "Web to Lead". However i do have the right ORG iD and Record type id included on the xml file:   &lt;input type=hidden name="oid" value="xxxxxxxxxxxxx"&gt; &lt;input type=hidden name="recordType" id="recordType" value="zzzzzzzzzzzzzzzzzz"&gt;    trigger IAAILeadTrigger on Lead (before insert, before update){ //BEGIN: S-444340 T-561808 - Process only IAA Remarketing Recordtype data     Map&lt;ID,Schema.RecordTypeInfo&gt; rt_Map = Lead.sObjectType.getDescribe().getRecordTypeInfosById();      //Looks up the branches based on the Lead PostalCode     if(trigger.isBefore){          for(Lead ld : trigger.new){                      if (rt_map.get(ld.recordTypeID).getName().containsIgnoreCase('IAA Remarketing') )                if( trigger.isInsert ||                    (trigger.isUpdate &amp;&amp; ld.Branch__c == null) ||                   (trigger.isUpdate &amp;&amp; ld.PostalCode != trigger.oldMap.get(ld.id).PostalCode)               ){                   leads.add(ld);               }           }           }                 //Only check the leads that are in the lead list and NOT the full trigger.new list         if(!leads.isEmpty()){             LeadController.GetLeadBranches(leads);           }     }  }
87958
I have a page where I am trying to show which ListViews a Project is in. I can get the data I want in the Developer Console by querying ListView. However, when I try to import the following query to my code I get the following exception: "Save error: sObject type 'ListView' is not supported." Query:  SELECT Id, Name FROM ListView WHERE SObjectType = 'Project__c'   As a workaround, I am trying to instantiate an Apex:StandardSetController for Project__c and call getListViewOptions(). Notice I am not calling getListViewOptions on my ApexPages.StandardController. The relevant bit that is not working:  public MyExtension(ApexPages.StandardController notUsed) {     debugListViews(); // yields bogus results } public MyExtension(ApexPages.StandardSetController notUsed) {     debugListViews(); // yields valid results } private void debugListViews() {     ApexPages.StandardSetController controller = new ApexPages.StandardSetController([         SELECT Id FROM Project__c LIMIT 1     ]);     for (SelectOption option : controller.getListViewOptions())     {         system.debug(option);     } }   This code works perfectly in Execute Anonymous. I see a list of SelectOption each of which has a valid Name/Id combination. However, when I run this code in my extension's constructor that takes in an ApexPages.StandardController, I get only one SelectOption that is clearly bogus. The Name is "All" and the Id is "000000000000000AAA". Note: the key prefix for ListView is "00B."  To add to the mystery, this code also works as expected in my extension constructor that takes in an ApexPages.StandardSetController.  This seems like it is a Salesforce bug, but I am not allowed to submit a Development Case for this org. Has anyone run into this before and found a workaround?
18921
Is it possible to perform a Delete from a Data Extension using Query or something?  Like we have Insert/Update option in a query, I would like to delete.   I know this can done using API but is that the only way to perform automatic deletions from a data extension?
110175
I am receiving an error stated above on line 26**(listAccount1)**, can anyone guide me on how to solve it?  public class FRB_UpdateExceptionsforBatch {    public static void FRB_Exceptions(){    string FRBRecordTypeID = utility.getFRBProfileNameLabel();       List&lt;Account&gt; lstAccount = new List&lt;Account&gt;();         List&lt;Account&gt; lstAccount1 = new List&lt;Account&gt;();         List&lt;Account&gt; lstAccount2 = new List&lt;Account&gt;();         List&lt;Account&gt; lstAccount3 = new List&lt;Account&gt;();    lstAccount = [Select id,FRB_Firm_Check__c,Number_of_Exception__c,Number_of_exceptions_under_4_6_bucket__c,Number_of_exceptions_under_7_10_bucket__c,Number_of_exceptions_under_11_19_bucket__c,(select id,Account_Standing__c from Process_Adherence_Monitoring__r  where Status__C != 'Closed' AND  recordtypeId =: FRBRecordTypeID AND Account_Standing__c = '0-3 Days (Green - New Exception)' ) FROM Account WHERE FRB_Firm_Check__c = TRUE];     if(lstAccount.size()&gt;0){           for( Account acc : lstAccount )           {               List&lt;Process_Adherence_Monitoring__c&gt; lstCont = acc.Process_Adherence_Monitoring__r;                acc.Number_of_Exception__c = lstCont.size();               acc.FRB_Firm_Check__c = true;           }            update lstAccount;     }         //To update 4-6 bucket      lstAccount1 = [select Id, Name,FRB_Firm_Check__c, Number_of_exceptions_under_4_6_bucket__c,(select id,Account_Standing__c from Process_Adherence_Monitoring__r  where Status__C != 'Closed' AND  recordtypeId =: FRBRecordTypeID AND Account_Standing__c = '4-6 Days (Yellow - Outside Correction Timeframe)' ) from Account where FRB_Firm_Check__c = TRUE];        if(lstAccount1.size()&gt;0){           for( Account acc : lstAccount1 )           {               List&lt;Process_Adherence_Monitoring__c&gt; lstCont1 = acc.Process_Adherence_Monitoring__r;                              acc.Number_of_exceptions_under_4_6_bucket__c= lstCont1.size();               acc.FRB_Firm_Check__c = true;           }            update lstAccount1 ;       }         //To update 6-11 bucket         lstAccount2 =  [select Id, Name,FRB_Firm_Check__c, Number_of_exceptions_under_7_10_bucket__c,(select id,Account_Standing__c from Process_Adherence_Monitoring__r  where Status__C != 'Closed' AND  recordtypeId =: FRBRecordTypeID AND Account_Standing__c = '7-10 Days (Orange - Approaching Critical Timeframe)' ) from Account where FRB_Firm_Check__c = TRUE];        if(lstAccount2.size()&gt;0){           for( Account acc : lstAccount2 )           {               List&lt;Process_Adherence_Monitoring__c&gt; lstCont2 = acc.Process_Adherence_Monitoring__r;                acc.Number_of_exceptions_under_7_10_bucket__c= lstCont2.size();               acc.FRB_Firm_Check__c = true;           }           update lstAccount2 ;       }        //To update 11 bucket            lstAccount3 =  [select Id, Name,FRB_Firm_Check__c, Number_of_exceptions_under_11_19_bucket__c,(select id,Account_Standing__c from Process_Adherence_Monitoring__r  where Status__C != 'Closed' AND  recordtypeId =: FRBRecordTypeID AND Account_Standing__c = '11-19 Days (Red - Immediate Correction Required)' ) from Account where FRB_Firm_Check__c = TRUE];        if(lstAccount3.size()&gt;0){           for( Account acc : lstAccount3 )           {               List&lt;Process_Adherence_Monitoring__c&gt; lstCont3 = acc.Process_Adherence_Monitoring__r;                acc.Number_of_exceptions_under_11_19_bucket__c= lstCont3.size();               acc.FRB_Firm_Check__c = true;           }                              update lstAccount3 ;       }      }   }
46169
I'm getting an error INACTIVE_OWNER_OR_USER, operation performed with inactive user, and I have been doing a lot of research and the cause that I have found for this is its attempting to assign a my lead to inactive user.  So I understand that part I think the issue is now I don't actually know how to fix it, I didn't write this trigger/test class and I'm not sure how to go forward.  Do I need to create a new Test User?  I've never worked on the Lead object before..  Edit** I added IsActive = True the trigger user query, no luck.  Edit** I just went talking to anyone that might have an idea about UserTypes, and they have no idea what UserType = 'PowerPartner' is.  So I changed it to a different UserType.. didn't work  Edit**  I'm nuking this trigger, I have to re write it..  Test Class  @isTest private class PartnerLeadShare_test { static testMethod void myUnitTest1() { List&lt;Lead&gt; leadList = new List&lt;Lead&gt;(); List&lt;LeadShare&gt; leadShareList = new list&lt;LeadShare&gt;();   Lead ld = new Lead(); ld.lastName = 'Tester';//=/ ld.Company = 'MyCompany'; ld.Status = 'Open'; ld.Program_EAU__c ='11'; insert ld; system.debug('ld****' +ld);  GroupMember groupMemberStore = [select GroupId,UserOrGroupId from GroupMember limit 1];  LeadShare ls = new LeadShare();  ls.LeadId = ld.id; ls.UserOrGroupId = groupMemberStore.UserOrGroupId ; ls.LeadAccessLevel = 'Edit'; leadShareList.add(ls);   if(leadShareList.size()&gt;0){     system.debug('INSIDE LEADSHARE LIST.');      insert leadShareList;  }  } }   Don't know this will help but here is my trigger..  trigger PartnerLeadShare on Lead (after insert,after update) {  Map&lt;id,User&gt;PartnerUsermap = new Map&lt;id,user&gt;([select id,UserType from user where      UserType = 'PowerPartner' and IsActive = True] );    List&lt;GroupMember&gt;GroupMemberList = new List&lt;GroupMember&gt;([select GroupId,UserOrGroupId   from GroupMember]);   System.debug('PartnerUsermap ===  '  +PartnerUsermap); System.debug('GroupMemberList    '+GroupMemberList );  List&lt;LeadShare&gt; leadShareList = new list&lt;LeadShare&gt;();    if(!PartnerUsermap.isEmpty()){ for(Lead ld: trigger.new){      for(GroupMember grpmem : GroupMemberList){         if(grpmem.UserOrGroupId == ld.CreatedById){               LeadShare ldShare = new LeadShare (LeadId = ld.id,UserOrGroupId = grpmem.GroupId,LeadAccessLevel = 'Edit');              leadShareList.add(ldShare );         }     } } } if(!leadShareList.isEmpty()){ Database.SaveResult[] lsr = Database.insert(leadShareList,false);            Integer i=0; for(Database.SaveResult sr : lsr){     if(!sr.isSuccess()){     Database.Error err = sr.getErrors()[0];              if(!(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION                                              &amp;&amp;  err.getMessage().contains('AccessLevel'))){                  trigger.newMap.get(leadShareList[i].LeadId).                   addError(                    'Unable to grant sharing access due to following exception: '                    + err.getMessage());             }     }    i++; } }
105415
This is the test method i have writtenfor batch apex ProductUpdate  .Even if i have a single callout to Database.Executebatch()  I am getting the following error.  Please help !  @isTest (seeAllData=true) global class testbatchProductUpdate  {     public static testMethod  void  pBatchUpdate()     {          /** Product to meet the Criteria in test class **/          Product2 p = new Product2();         p.Name = 'Test Product';         p.Effective_Date__c = Date.Today();         //p.CurrencyIsoCode= 'USD';         p.Material_status__c='status';         insert p;          /** Product to meet the Criteria in test class **/           test.startTest();         batchProductUpdate bpu = new batchProductUpdate();         database.Executebatch(bpu);         test.stopTest();     }  }      Error :  System.UnexpectedException: No more than one executeBatch can be called from within a testmethod. Please make sure the iterable   returned from your start method matches the batch size, resulting in   one executeBatch invocation.", Failure Stack Trace: "External entry   point"
103246
I can't seem to call the objects out on the database and onto a visualforce page using this set up:   public with sharing class HarborEventController {  private final Event__c event; public HarborEventController(ApexPages.StandardController controller) {     this.eventlist = (Event__c)controller.getRecord(); }   public Integer eventcount{get;set;} public HarborEventController (){    eventcount = [SELECT COUNT() FROM Event__c];     }   public list&lt;Event__c&gt; mainlist {get;set;}   public list&lt;Event__c&gt; displayevents(){     mainlist = new list&lt;Event__c&gt;();     String mainsoql = 'SELECT Id, Name__C, Message__c, Display_Date__c, FROM Event__c';      mainsoql += 'ORDER BY Display_date__c LIMIT :5';     mainlist = Database.query(mainsoql);     return mainlist; }   and the visualforce page :           &lt;apex:composition template="eh_base"&gt;           &lt;apex:define name="heros-content"&gt;             &lt;/apex:define&gt;       &lt;apex:define name="content"&gt;        &lt;section id="services-sec"&gt;          &lt;div class="container"&gt;             &lt;div class="row" style="padding-top: 60px;"&gt;       &lt;apex:outputPanel layout="block" rendered="{!AND(NOT(ISNULL(mainlist)),mainlist.size&gt;0)}"&gt;         &lt;apex:form id="blockofeventtorepeat"&gt;             &lt;apex:repeat value="{!mainlist}" var="evententry" id="repeat"&gt;                 &lt;div class="col-md-9"&gt;                    &lt;h3&gt;&lt;apex:outputLink styleClass="evententry-header block" value="{!$Page.eh_eventdetails}?id={!evententry.id}"&gt;{!evententry.Name__c}&lt;/apex:outputLink&gt;&lt;/h3&gt;                     &lt;apex:outputPanel &gt;                      &lt;p&gt;                          &lt;img src="{!URLFOR($Action.Attachment.Download, evententry.Attachments[0].Id)}" class="pull-left img-responsive" alt="" style="max-width:180px;max-height:100px"/&gt;                         {!evententry.Message__c}                      &lt;/p&gt;                        &lt;apex:outputLink styleclass="btn btn-sm btn-default" value="{!$Page.eh_eventdetails}?id={!evententry.id}"&gt;Read More&lt;/apex:outputLink&gt;                      &lt;/apex:outputPanel&gt;                 &lt;/div&gt;                 &lt;/apex:repeat&gt;                 &lt;/apex:form&gt;                 &lt;/apex:outputPanel&gt;                   &lt;/div&gt;             &lt;/div&gt;                 &lt;/section&gt;           &lt;/apex:define&gt; &lt;/apex:composition&gt;     Can anyone suggest how I can able to get the event data from the query and display it on a visualforce page in a repeat tag? I've tried everything and it doesn't work.  I've already tried passing the query from an anonymous user and the results were as expected
103112
When and why would somebody do the following:  doSomething( (MyClass) null );   Have you ever done this? Could you please share your experience?
439
Consider:  namespace WindowsApplication1 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }          private void button1_Click(object sender, EventArgs e)         {             //int[] val = { 0, 0};             int val;             if (textBox1.Text == "")             {                 MessageBox.Show("Input any no");             }             else             {                 val = Convert.ToInt32(textBox1.Text);                 Thread ot1 = new Thread(new ParameterizedThreadStart(SumData));                 ot1.Start(val);             }         }          private static void ReadData(object state)         {             System.Windows.Forms.Application.Run();         }          void setTextboxText(int result)         {             if (this.InvokeRequired)             {                 this.Invoke(new IntDelegate(SetTextboxTextSafe), new object[] { result });             }             else             {                 SetTextboxTextSafe(result);             }         }          void SetTextboxTextSafe(int result)         {             label1.Text = result.ToString();         }          private static void SumData(object state)         {             int result;             //int[] icount = (int[])state;             int icount = (int)state;              for (int i = icount; i &gt; 0; i--)             {                 result += i;                 System.Threading.Thread.Sleep(1000);             }             setTextboxText(result);         }          delegate void IntDelegate(int result);          private void button2_Click(object sender, EventArgs e)         {             Application.Exit();         }     } }   Why is this error occurring?     An object reference is required for the nonstatic field, method, or property 'WindowsApplication1.Form1.setTextboxText(int)