About casting objects.

From what I understand, a child class inherits all the properties from its parent class and it may contains additional properties that the parent class does not have. Suppose the parent and child classes are declared as follows.
class Parent {
public void parentX() {}
class Child {
public void ChildX() {}
If I cast a child object to a parent object by doing:
Child c = new Child();
Parent p = (Parent)c;
.. and then cast it back to child class.
Child c2 = (Child)p;
I can still access c2.ChildX(). I was guessing that when you do a upcast (child->parent), the child-specific properties are lost because the parent variable was not allocated enough memory to hold the additional properties. But the above example proves otherwise. Can someone explain?

And casting is mostly telling the compiler what member
methods you have. Because three classes could all have
a method toString() so the compiler needs to know
which of these you mean when you put c.toString().I dont think if you have the same method for both parent and child class, casting will changes which one is called. For example, if a callme() is added as follows:
class Parent {
public void callme() { System.out.println("in parent"); }
class Child extends Parent {
public void callme() { System.out.println("in child"); }
And if you do:
Parent p = (Parent)(new Child);
p.callme();
This will print out "in child". So casting doesnt change which method is called.

Similar Messages

  • Question about casting objects into Number

    This might sound a bit silly, but i have a function that
    casts an Object into a Number and then checks if it is NaN to
    ensure that it is indeed a number, it returns true if it is a valid
    number or false if it isn't a number
    Now i have a TextInput and when i type for example "HELLO"
    and call the function it returns false (since that is not a
    number), if i type 23 it returns true (it is a number), if i type
    "20a" it returns false. Everything works fine except for one
    combination, if i type any number and the letter "e", for example
    2e, 9E, 5e, etc, it returns true, which means this is a valid
    Number, why is this?

    I thought it might be that, but for my bussiness logic, 2e is
    not a valid number.......will i need to parse the string and
    validate it?

  • Getting information about an object from JList

    Hi
    I have created a movie application and i have a JList displaying all registered movies, it uses a DefaultListModel to display these.
    I want to be able to click on an element in the JList and then push a button called "Show movie details" to display all information about the selected movie.'.
    Every new movie is added to the DefaultListModel as an object with "Titlle", "Genere" etc. If someone click on a movie, what do i do to get information about which object that was clicked. All i can see is that integers can be returned with the getSelectedIndex/Value methods. If i use one of these methods to get the object from the DefaultListModel, that would work i guess, but what when someone deletes a movie in the middle of the JList, then the indexes wouldnt match.
    Can someone help me out here? :)

    I get a big fat exception when trying to cast the returned object to a Movie object which im using.
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.S
    tring cannot be cast to Movie
    ...sure that this is the way to do it? If so, what am i doing wrong..

  • Crystal Reports Server Error - Unable to cast object of type

    Hi Everyone,
    Not sure if this is the right place to post this question but couldn't find a Crystal Reports Server section.
    After doing a windows update on my crystal reports server the following error now occurs when trying to log into .Net InfoView -
    An error has occurred: Unable to cast object of type 'CrystalDecisions.Enterprise.InfoObject' to type 'BusinessObjects.Enterprise.Desktop.InfoView'.
    I found the following article which I followed and re-installed the .net components as well as ensured all services are enabled.
    Article: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_bip/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233303335333433323337%7D.do
    The error still occurs.
    I did some further investigation and found that a similar error occurs in the Admin Console when I try and open the Crystal Report DataSources.
    This is the error page that comes up
    Server Error in '/businessobjects/Enterprise11/WebTools' Application.
    Unable to cast object of type 'CrystalDecisions.Enterprise.InfoObject' to type 'CrystalDecisions.Enterprise.Desktop.Report'.
    +Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
    about the error and where it originated in the code.+
    +Exception Details: System.InvalidCastException:
    Unable to cast object of type 'CrystalDecisions.Enterprise.InfoObject' to type 'CrystalDecisions.Enterprise.Desktop.Report'.+
    Source Error:
    +The source code that generated this unhandled exception can only be shown when compiled in debug mode.
    To enable this, please follow one of the below steps, then request the URL:+
    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
      <%@ Page Language="C#" Debug="true" %>
    or:
    2) Add the following section to the configuration file of your application:
    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>
    +Note that this second technique will cause all files within a given application to be compiled in debug mode.
    The first technique will cause only that particular file to be compiled in debug mode.+
    +Important: Running applications in debug mode does incur a memory/performance overhead.
    You should make sure that an application has debugging disabled before deploying into production scenario.+
    Stack Trace:
    InvalidCastException: Unable to cast object of type 'CrystalDecisions.Enterprise.InfoObject' to type 'CrystalDecisions.Enterprise.Desktop.Report'.
       +CrystalDecisions.Enterprise.WebContent.WebSamples.DataSources.Common.datasourceInfoFromReports(ArrayList reports) 226
       +CrystalDecisions.Enterprise.WebContent.WebSamples.DataSources.Datasources.Main() 1821
       +ASP.websamples_datasources_datasources_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) 531
       +System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 98
       +System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 20
       +System.Web.UI.Page.Render(HtmlTextWriter writer) 26
       +System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 25
       +System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 121
       +System.Web.UI.Control.RenderControl(HtmlTextWriter writer) 22
       +System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 2558
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
    Any information on how I can fix this is greatly appreciated.
    Regards
    Paul
    Edited by: Paul Griscti on Sep 3, 2008 2:52 AM

    I'd try creating a new Application Pool just for running businessobjects and crystalreportviewers11 and nothing else. 
    Although the apps are .NET, it uses COM Interop for functionality, so using a common app pool with other versions will collide.
    Beyond that - if you have a SAP Business Objects support contract - you might open a new SAP Incident ticket.
    Sincerely,
    Ted Ueda

  • Casting Object

    hi;
    i have to finish a coursework in two days time.it is about a program to process payroll activities in a factory.i wrote a class to create objects type employee which consists of (String name,String surname,boolean gender,int empNum...).
    the coursework asks for keeping the information generated by the program in an external file.in order to ease processing and updating the information which are in form employee,i decided to transfer employee's ,which are stored in a file named manual.dat,to a vector when i need to change or add data and to transfer employee's of vector to the manual.dat after i finished data processing.i now countered with two problems:
    1-when there is no data in manual.dat,how can i start the vector?
    2-i need to search the employee's by using empNum(employee ID number)assearchkey. how can i cast Objects in the vector to type 'employee' to get the empNums?
    please reply as soon as possible..
    thanks

    Do you mean this in #2?
    Employee emp = (Employee) vector.get(i);

  • T cast(Object obj)

    Hi,
    What is the actual use of this method T cast(Object obj) that "casts an object to the class or interface represented by this Class object." ?
    If we pass the class token as a parameter then we already know what type it is and this seems to be the only way to to determine the concrete type at runtime. How is this method used ?
    Thanks,
    Mohan

    Class.cast helps you avoid an "Unchecked" warning. That's about all there is to it. Example:
    import java.util.HashMap;
    import java.util.Map;
    public abstract class Factory<T> {
         public abstract T newInstance();
         public static <TT> TT createObject(Class<TT> clazz) {
              Factory<?> factory = factories.get(clazz);
              if(factory == null)
                   throw new IllegalArgumentException("invalid class "+clazz.getName());
              return (TT)factory.newInstance(); // Unchecked warning
         public static <TT> void registerFactory(Class<TT> clazz, Factory<? extends TT> factory) {
              factories.put(clazz, factory);
         private static final Map<Class<?>, Factory<?>> factories = new HashMap<Class<?>, Factory<?>>();
    }The line with the comment will trigger an "Unchecked" warning, which could be avoided by using
    return clazz.cast(factory.newInstance());

  • Unable to cast object of type 'Oracle.DataAccess.Types.OracleDecimal'......

    I have some Oracle Tables with sequences for primary key and stored procs in packages to wrap up the insert commands. The sequences field are all declared as NUMBER.
    I also have Datasets based on the tables and a DataAdapter for each package. The Datasets see the primary keys as System.Decimal. The DataAdapter sees the output primary key parameter to the stored procs as OracleDecimal.
    tmp.Parameters.Add(new OracleParameter("P_ID", Oracle.DataAccess.Client.OracleDbType.Decimal, ParameterDirection.Output));
    tmp.Parameters["P_ID"].SourceColumn = "ID";
    When I call the Update on the DataAdapter the update happens on the DB and then I get the following error
    System.ArgumentException : Unable to cast object of type 'Oracle.DataAccess.Types.OracleDecimal' to type 'System.IConvertible'.Couldn't store <231> in ID Column. Expected type is Decimal.
    ----> System.InvalidCastException : Unable to cast object of type 'Oracle.DataAccess.Types.OracleDecimal' to type 'System.IConvertible'.
    If I change the Oracle parameter to Oracle.DataAccess.Client.OracleDbType.Int32 or Oracle.DataAccess.Client.OracleDbType.Int64 it works fine - any ideas why that would be ? I would expect System.Decimal to map to Oracle.DataAccess.Types.OracleDecimal.

    Hi,
    If I change the Oracle parameter to Oracle.DataAccess.Client.OracleDbType.Int32 or Oracle.DataAccess.Client.OracleDbType.Int64 it works fine - any ideas why that would be ? I would expect System.Decimal to map to Oracle.DataAccess.Types.OracleDecimal.
    I'm trying to do the same, but no matter what I do, I get the OracleDecimal error. Parameter is defined as:
    bq. this._adapter.InsertCommand = new global::Oracle.DataAccess.Client.OracleCommand(); \\ this._adapter.InsertCommand.Connection = this.Connection; \\ this._adapter.InsertCommand.CommandText = "INSERT INTO PERSON\r\n                      (ID, SURNAME, NAME, BIRTHCITY, EMSO)\r\nV" + \\ +"ALUES (:ID, :SURNAME, :NAME, :BIRTHCITY, :EMSO) RETURNING ID INTO :ID";+ \\ this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; \\ param = new global::Oracle.DataAccess.Client.OracleParameter(); \\ param.ParameterName = "ID"; \\ param.DbType = global::System.Data.DbType.Int32; \\ param.OracleDbType = global::Oracle.DataAccess.Client.OracleDbType.Int32; \\ param.Direction = global::System.Data.ParameterDirection.Output; \\ param.IsNullable = true; \\ param.SourceColumn = "ID"; \\ this._adapter.InsertCommand.Parameters.Add(param);
    But no luck...

  • Unable to cast object of type OracleXmlType to type XmlDocument

    Hello All:
    I have an Oracle Procedure that is taking an XML Document as an output parameter.
    oCommand.Parameters.Add("errorrecord", OracleDbType.XmlType).Value = System.DBNull.Value;
    oCommand.Parameters["errorrecord"].Direction = System.Data.ParameterDirection.Output;
    When I try to cast this as an XmlDocument so I can set it to my ErrorRecord variable (defined as XmlDocument) and pass it back out of the Web-Service
    ErrorRecord = (XmlDocument)oCommand.Parameters["p_errorrecord"].Value;
    I get the following error: "Unable to cast object of type 'Oracle.DataAccess.Types.OracleXmlType' to type 'System.Xml.XmlDocument'"
    How do I cast / convert the Oracle XMLType back to a .Net XMLDocument to pass out of the function?
    Thanks

    No, I have not tried that yet, but I admit I don't fully understand the syntax in the document posted.
    oCommand.Parameters.Add("p_errorrecord", OracleDbType.XmlType).Value = System.DBNull.Value;
    ErrorRecord = GoCommand.Parameters["errorrecord"].Value; (this is returned as XmlType)
    I don't quite understand the syntax in the posted URL:
    Declaration
    // C#
    public XmlDocument GetXmlDocument();
    How am I to use this to get the XMLDocument?

  • Unable to cast object of type InfoObject to DestinationPlugin

    I have created a web application to show the list of scheduled reports and with their destination Info using Business objects sdk. Locally on my computer i am able to show all the reports and the Ftp information. But when i move this application to QA server the application returns an error with a message.
    "Unable to cast object of type 'CrystalDecisions.Enterprise.InfoObject' to type 'CrystalDecisions.Enterprise.DestinationPlugin"
    I have noticed that the returned type of Object by the query on QA server is of type "InfoObject" and on localbox "CrystalDecisions.Enterprise.Dest.Ftp"
    Query
    Select * from ci_systemobjects where SI_NAME= ''", "CrystalEnterprise.Ftp"
    Assemblies required by application are registered in the GAC with same version and same public token
    Please let me know if anyone has a answer for this casting exception.

    Snippet:
    Dim ftp As New Ftp(infoObject.PluginInterface)
    Dim ftpOptions As New FtpOptions(ftp.ScheduleOptions)
    You wouldn't be doing a direct runtime cast.
    Sincerely,
    Ted Ueda

  • Unable to cast object of type 'System.Xml.XmlText' to type 'System.Xml.XmlE

    Hi All,
    We just migrated from BPC 5.1 to BPC 7.0 SP6. But when we want to run a package in the data manager we get the following error:
    Exception Text **************
    System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlText' to type 'System.Xml.XmlElement'.
       at OSoft.Consumers.DataMgr.PackageModify50.PackageDetail.LoadDetail(String strXMLString)
       at OSoft.Consumers.DataMgr.PackageModify50.PackageDetail.GetPackageDetailfromServer(String strPackageName, String strPackageFilePath, String strTeamID)
       at OSoft.Consumers.DataMgr.PackageModify50.frmMain.PackageListClickEvent(String strPackageID, String strPackageFileName, String strTeamID)
       at OSoft.Consumers.DataMgr.PackageModify50.frmMain.SetStartUp()
       at OSoft.Consumers.DataMgr.PackageModify50.frmMain.frmMain_Load(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Any idea?
    Br
    Steven

    Hi,
    If you were running 5.1 version, that would also mean that you were running packages under SQL 2005.
    And if you are now running SQL 2008 with BPC 7.0, you should also review all your customized packages. In fact, BPC tasks in SSIS are not the same between SQL 2005 and SQL 2008.
    In addition, I would recommend to upgrade your SQL server version to SQL 2008 SP1 cumulative update package 6 (prerequisite). Not sure if you're still running this CU.
    Hope this will help.
    Best Regards,
    Patrick

  • Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type

    when I using below code :
     using (ServiceContext svcContext = new ServiceContext(service))
                    var creditNote = svcContext.new_credit_noteSet.Where(c => c.new_credit_noteId == cnid).FirstOrDefault();
    got this error:
    System.InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'TCT.CRM.Model.new_credit_note'.
       at System.Linq.Enumerable.&lt;CastIterator&gt;d__b1`1.MoveNext()
       at Microsoft.Xrm.Sdk.Linq.PagedItemCollection`1.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
       at HP.Crm2013.Plugins.ServiceManage.sm_credit_note_update_post.CalculateTotalAmount(IOrganizationService service, Guid cnid)
       at HP.Crm2013.Plugins.ServiceManage.sm_credit_note_update_post.Execute(IServiceProvider serviceProvider)
    any help?
    Awen

    Hi Awen,
    This kind of error usualy occur if we dont have enable proxytype for the CRM service.
    Add the below line in your code after creating the service proxy and check :
    _serviceProxy.EnableProxyTypes();
    Thanks,
    Seban

  • Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'

    same code worked fine under Support Pack 8 (v. 13.0.8.1216).
    When we upgraded to newest service pack 13, we started getting an error Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'
       Dim rpt   As New MemoryStream()
           Using ProfileRpt As New test.CrystalReport()            
        ProfileRpt.SetDataSource(ds)        
           rpt  = DirectCast(ProfileRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), MemoryStream)     
           End Using
    similar as
    http://scn.sap.com/thread/3714796
    http://scn.sap.com/thread/2020974
    http://scn.sap.com/thread/3283915
    http://scn.sap.com/thread/3680358

    Same answer, we never supported MemoryStream, convert to IO.Stream then it should work.
    http://scn.sap.com/thread/3322762

  • Unable to cast object of type ?

    Hi ,
    i try to compile sample aspx page using plugin but it throws the error
    Unable to cast object of type 'asp.catalog_sample_aspx' to type 'netpoint.classes.NPbasepage'
    why this type error shows?
    pls guide me.

    here is an example of a page that inherits NPBasePage.
    <%@ Page Language="C#" MasterPageFile="~/masters/common.master" Inherits="netpoint.classes.NPBasePage" %>
    <%@ Import Namespace="netpoint.classes" %>
    <%@ Import Namespace="netpoint.api.account" %>
    <asp:Content ContentPlaceHolderID="mainslot" runat="server" ID="main">
        <asp:PlaceHolder ID="phMainSlot" runat="server">
            <scrip t language="c#" runat="server"> 
                protected void Page_Load(object sender, System.EventArgs e)
                    NPBasePage bp = (NPBasePage)Page;
                    NPUser u = new NPUser(bp.UserID);
                    txtBox.Text = u.FirstName + " " + u.LastName;
            </script>
            <div>
                <asp:TextBox ID="txtBox" runat="server"></asp:TextBox>
            </div>
        </asp:PlaceHolder>
    </asp:Content>

  • Unable to cast object of type infostore to type report

    Hi all,
    Does anyone know what causes the message:-
    system.invalidcastexception: unable to cast object of type 'crystaldecisions.enterprise.infoobject' to type 'crystaldecisions.desktop.report'
    Everything works perfectly in my development environment but as soon as I try to put the code live I get the error.
    it is happening in the following lines of code:-
            Dim CEinfoObjects As InfoObjects
            Dim CEReport As Report
            Dim CEParameters As ReportParameters
            Dim CEParameter As ReportParameter
                CE_SQL = "SELECT SI_PROCESSINFO.SI_PROMPTS "
                CE_SQL += "FROM CI_INFOOBJECTS "
                CE_SQL += "WHERE SI_ID = " & ReportID
                CEReports = ceInfoStore.Query(CE_SQL)
                CEReport = CEinfoObjects(1)
                CEParameters = CEReport.ReportParameters
    I tried changing the ceReport type to an InfoObject type and the system then fails trying to get the parameters. (ReportParameters is not a member of InfoObject)
    The only differences I can see is that my dev machine has Crystal XI SP4, Crystal 2008 SP0 and Crystal Server XI SP4 installed while the live environment only has Crystal XI SP4.
    I tried installing the 2008 runtime to see if that would make a difference but it has not.
    I tried reinstalling the XI runtime but it has not worked either.
    Is there something that needs to be changed on the enterprise server?  This is also running on XI SP4 and the files match the dates and times on my dev machine.
    Any help or pointers would be appreciated.

    ' Add the Scheduling Information
                    ' 0-0 Once, Now
                    ' 0-1 Once, At a specific time
                    ' 1-0 Daily, Once each day
                    ' 1-1 Daily, Every X hours and N minutes
                    ' 1-2 Daily, Every X days
                    ' 2-0 Weekly, Every week on
                    ' 3-0 Monthly, On the Nth day of the month
                    ' 3-1 Monthly, On the Nth X of the month
                    ' 3-2 Monthly, Every N months
                    Select Case ScheduleRow("RecurrenceType").ToString
                        Case 0
                            Select Case ScheduleRow("RecurrencePattern").ToString
                                Case 0
                                    ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeOnce
                                    ceScheduleInfo.RightNow = True
                                Case 1
                                    ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeOnce
                                    ceScheduleInfo.RightNow = False
                                    ceScheduleInfo.BeginDate = ScheduleRow("StartDate").ToString
                            End Select
                        Case 1
                            Select Case ScheduleRow("RecurrencePattern").ToString
                                Case 0
                                    ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeDaily
                                    ceScheduleInfo.RightNow = False
                                    ceScheduleInfo.BeginDate = ScheduleRow("StartDate").ToString
                                    ceScheduleInfo.EndDate = ScheduleRow("EndDate").ToString
                                Case 1
                                    ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeHourly
                                    ceScheduleInfo.RightNow = False
                                    ceScheduleInfo.BeginDate = ScheduleRow("StartDate").ToString
                                    ceScheduleInfo.EndDate = ScheduleRow("EndDate").ToString
                                    ceScheduleInfo.IntervalHours = ScheduleRow("X_Hours").ToString
                                    ceScheduleInfo.IntervalMinutes = ScheduleRow("N_Minutes").ToString
                                Case 2
                                    ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeDaily
                                    ceScheduleInfo.RightNow = False
                                    ceScheduleInfo.BeginDate = ScheduleRow("StartDate").ToString
                                    ceScheduleInfo.EndDate = ScheduleRow("EndDate").ToString
                                    ceScheduleInfo.IntervalDays = ScheduleRow("X_Days").ToString
                            End Select
                        Case 2
                            ceScheduleInfo.Type = CeScheduleType.ceScheduleTypeCalendar
                            ceScheduleInfo.RightNow = False
                            ceScheduleInfo.BeginDate = ScheduleRow("StartDate").ToString
                            ceScheduleInfo.EndDate = ScheduleRow("EndDate").ToString
                            If ScheduleRow("Monday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDayMonday, 0)
                            End If
                            If ScheduleRow("Tuesday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDayTuesday, 0)
                            End If
                            If ScheduleRow("Wednesday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDayWednesday, 0)
                            End If
                            If ScheduleRow("Thursday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDayThursday, 0)
                            End If
                            If ScheduleRow("Friday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDayFriday, 0)
                            End If
                            If ScheduleRow("Saturday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDaySaturday, 0)
                            End If
                            If ScheduleRow("Sunday").ToString = True Then
                                ceScheduleInfo.CalendarRunDays.Add(CDate(ScheduleRow("StartDate").ToString).Day, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Month, _
                                                                   CDate(ScheduleRow("StartDate").ToString).Year, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Day, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Month, _
                                                                   CDate(ScheduleRow("EndDate").ToString).Year, _
                                                                   CeDayOfWeek.ceDaySunday, 0)
                            End If

  • Unable to cast object of type 'System.DBNull' to type 'System.String'.

    Hi,
         I am getting Below error:
    Unable to cast object of type 'System.DBNull' to type 'System.String'. 

    Hello,
    Please confirm whether you are using sharepoint or not. If you are getting this error in sharepoint then Could you share your code with us? and also tell where you are getting this error.
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for

  • Can i tell if my ipod is being used with serial number

    Our Ipod touch is lost. We have the serial number. Is it possible to look up the serial number to see if the device is in use?

  • Losing Data Validation Messages when writing back to context

    ( The base for this question is the ALV grid in section 2 of this [TimeSheetMockUp|http://www.duke.edu/~michaelm/TimeCard/AnnotatedTimeSheet.jpg] ) Users enter values in the white cells which represent the hours recorded on a given day for a certain

  • Incoming invoice printing

    Hi All, we want to make the setting for printing voucher for all incoming out going payments and bank payments.in standard SAP at the time of document generating. KIndly explain the requird setting how to make it in SAP Thanks in advance, Regards, Jy

  • PO Confirmation create automatically

    Hi, Anyone knows an easy way to create PO confirmation automatically? Same Date and Quantity as requested. Essentially, we would like to create Order Acknowledgment on the confirmation tab and we would like this to happen at PO creation. Let me know

  • Pulling fla source into director

    Does anyone know how/if you can pull a flash movie(s) into Director and edit them within Director? Here's the situation. I have three flash movies that I have the source for (fla) that make up a preloader, the main movie and an exit scene. I have bee