1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Error: Must declare a body because it is not marked abstract, extern, or partial

Discussion in 'C#' started by MikeMak27, Jun 4, 2009.

  1. MikeMak27

    MikeMak27 New Member

    I'm writing a program for work and I consistently get the same error so the program will not compile. Towards the end of the code, I keep getting an error for the line,
    private void Form1_Load(object sender, EventArgs e);

    The error code says: Error 1 'XTAPI_Tutorial.Form1.Form1_Load(object, System.EventArgs)' must declare a body because it is not marked abstract, extern, or partial.
    Does anyone have any ideas. I am a newbie to the code language and cannot figure out what I am doing wrong. I am using VisualStudio2008. Thank You
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using XTAPI;
    namespace XTAPI_Tutorial
    {
    public partial class Form1 : Form
    {
    private TTGate ttGate = new TTGate();
    private TTDropHandler m_drop = null;
    private TTInstrObj m_instr = null;
    private TTInstrNotifyClass m_notify = null;
    public Form1()
    {
    InitializeComponent();
    m_drop = new TTDropHandler();
    m_drop.RegisterDropWindow((int)this.Handle);
    m_drop.OnNotifyDrop += new _ITTDropHandlerEvents_OnNotifyDropEventHandler(m_drop_OnNotifyDrop);
    m_notify = new TTInstrNotifyClass();
    m_notify.OnNotifyFound += new _ITTInstrNotifyEvents_OnNotifyFoundEventHandler(m_notify_OnNotifyFound);
    m_notify.OnNotifyNotFound += new _ITTInstrNotifyEvents_OnNotifyNotFoundEventHandler(m_notify_OnNotifyNotFound);
    m_notify.OnNotifyUpdate += new _ITTInstrNotifyEvents_OnNotifyUpdateEventHandler(m_notify_OnNotifyUpdate);
    m_notify.OnNotifyDepthData += new _ITTInstrNotifyEvents_OnNotifyDepthDataEventHandler(m_notify_OnNotifyDepthData);
    m_notify.EnableDepthUpdates = 1;
    }
    void m_notify_OnNotifyDepthData(TTInstrNotify pNotify, TTInstrObj pInstr)
    {
    try
    { }
    catch (System.Exception e)
    {
    MessageBox.Show(e.Message);
    }
    throw new NotImplementedException();
    }
    void m_notify_OnNotifyUpdate(TTInstrNotify pNotify, TTInstrObj pInstr)
    {
    try
    {
    string priceStr = (string)pInstr.get_Get("Last");
    }
    catch (System.Exception e)
    {
    MessageBox.Show(e.Message);
    }
    throw new NotImplementedException();
    }
    void m_notify_OnNotifyNotFound(TTInstrNotify pNotify, TTInstrObj pInstr)
    {
    MessageBox.Show("Instrument could not be found");
    throw new NotImplementedException();
    }
    void m_notify_OnNotifyFound(TTInstrNotify pNotify, TTInstrObj pInstr)
    {
    try
    {
    Array data = (Array)pInstr.get_Get("Contract,Exchange");
    string contract = data.GetValue(0).ToString();
    string exchange = data.GetValue(1).ToString();
    this.Text = contract + " " + exchange;
    }
    catch (System.Exception e)
    {
    MessageBox.Show(e.Message);
    }
    throw new NotImplementedException();
    }
    void m_drop_OnNotifyDrop()
    {
    throw new NotImplementedException("The method of operation is not implemented.");
    }
    private void Form1_Load(object sender, EventArgs e);
     
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
    ttGate.XTAPITerminate();
    }
    }
    }
     
    Last edited by a moderator: Jun 21, 2009
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Look at this line :
    Code:
    private void Form1_Load(object sender, EventArgs e);
    
    Delete this line and everything will be fine ! :)
     

Share This Page