I am starting to self learn Visual Cobol. I know and understand Cobol (68 & 74). I am struggling with Classes and methods. I can find examples of invokes for various situations but can't find any basic straightforward examples that I can follow and use.
It would be nice to have a basic introduction to classes and methods for Visual Cobol showing examples and solutions for simple programs. I would then be able to build on this knowledge in more complex situations. I would have thought that this would have been the place to start so as to encourage newcomers to use Visual Cobol. There are many people out there that would like to learn programming and Cobol is a good place to start. Anyway....
I am trying to create 1 Solution with 2 or more Projects using Managed Cobol and WPF windows.
Project 1 is a WPF Menu (TBMenu) window from which I want to invoke Project 2 which is a WPF data input (TBOrderInput) window.
Each time I build the solution or start without debugging I am returned an error:
Error COBCH0845 : Unknown type 'type TBOrderInput.Window2' TBMenu C:\Users\YY\Documents\Visual Studio 2015\Projects\TBSuite2\TBMenu\Window1.xaml.cbl 19 24
------------------------------------------------------------------
<Window x:Class="TBMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TBMenu" Height="350" Width="525" FontSize="16" BorderThickness="2,2,2,3">
<Canvas Background="#FFF4F5D3">
<Button x:Name="TBMenuOrderEntry" Content="Order Entry" Canvas.Left="196" Canvas.Top="58" Width="132" Click="button_Click"/>
<Button x:Name="TBMenuOrderReceived" Content="Order Received" Canvas.Left="196" Canvas.Top="102" Width="132" Click="button1_Click"/>
<Button x:Name="TBMenuItemSold" Content="Item Sold" Canvas.Left="196" Canvas.Top="147" Width="132" RenderTransformOrigin="-0.007,-0.16" Click="button2_Click"/>
<Button x:Name="TBMenuItemLost" Content="Item Lost" Canvas.Left="196" Canvas.Top="193" Width="132" RenderTransformOrigin="0.1,0.308" Click="button3_Click"/>
<Button x:Name="TBMenuExit" Content="Exit" Canvas.Left="196" Canvas.Top="259" Width="132" RenderTransformOrigin="0.431,0.492" Background="#FFFB8643" Click="button4_Click"/>
</Canvas>
</Window>
------------------------------------------------------------------------------------------
Identification Division.
*> Program-ID. TBMenu.
class-id. TBMenu is partial
inherits type System.Windows.Window.
Data Division.
Working-storage section.
*> TBMenu
method-id NEW.
procedure division.
invoke self::InitializeComponent
goback.
end method.
*> Order Entry
method-id button_Click.
procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
invoke type TBOrderInput.Window2::New.
end method.
*> Exit Program
method-id button4_Click. *>final private.
procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
invoke self::Close.
end method.
end class.
--------------------------------------------------------------------------------------------
<Window x:Class="TBOrderInput.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Order Input" Height="408.53" Width="468.529">
<Canvas>
<ComboBox x:Name="Company" Canvas.Left="132" Canvas.Top="10" Width="120" SelectionChanged="Company_SelectionChanged"/>
<Label x:Name="label1" Content="Item Group" Canvas.Left="20" Canvas.Top="43"/>
<ComboBox x:Name="ItemGroup" Canvas.Left="132" Canvas.Top="43" Width="120" SelectionChanged="ItemGroup_SelectionChanged"/>
<Label x:Name="label2" Content="Item Type" Canvas.Left="20" Canvas.Top="78"/>
<ComboBox x:Name="ItemType" Canvas.Left="132" Canvas.Top="78" Width="120" SelectionChanged="ItemType_SelectionChanged"/>
<Label x:Name="label3" Content="Item Name" Canvas.Left="20" Canvas.Top="109"/>
<ComboBox x:Name="ItemName" Canvas.Left="132" Canvas.Top="109" Width="266" SelectionChanged="ItemName_SelectionChanged"/>
<Label x:Name="label4" Content="Item Style/Colour" Canvas.Left="20" Canvas.Top="140"/>
<ComboBox x:Name="ItemStyleColour" Canvas.Left="132" Canvas.Top="140" Width="120" SelectionChanged="ItemStyleColour_SelectionChanged"/>
<Label x:Name="label5" Content="Date Ordered" Canvas.Left="20" Canvas.Top="171"/>
<DatePicker Canvas.Left="132" Canvas.Top="171"/>
<Label x:Name="label6" Content="Order Value" Canvas.Left="20" Canvas.Top="202"/>
<TextBox x:Name="OrderValue" Height="23" Canvas.Left="132" TextWrapping="Wrap" Canvas.Top="202" Width="120" TextChanged="OrderValue_TextChanged"/>
<Button x:Name="InputAdd" Content="Input Order and Add Another" Canvas.Left="20" Canvas.Top="241" Width="172" Click="InputAdd_Click"/>
<Button x:Name="InputClose" Content="Input Order then Exit" Canvas.Left="20" Canvas.Top="273" Width="172" Click="InputClose_Click"/>
<Button x:Name="RestartInput" Content="Restart Input" Canvas.Left="20" Canvas.Top="305" Width="172" Click="RestartInput_Click"/>
<Button x:Name="CloseInput" Content="Exit" Canvas.Left="20" Canvas.Top="337" Width="172" Click="CloseInput_Click"/>
</Canvas>
</Window>
-------------------------------------------------------------------------------
000100 Identification Division.
000200
000300 class-id TBOrderInput.Window2 is partial
000400 inherits type System.Windows.Window.
000500
000600 working-storage section.
000700
000800 method-id NEW.
000900 procedure division.
001000 invoke self::InitializeComponent
001100 goback.
001200 end method.
001300
001400 method-id Company_SelectionChanged.
001500 procedure division using by value sender as object e as type System.Windows.Controls.SelectionChangedEventArgs.
001600 end method.
-
003700
003800 method-id InputAdd_Click.
003900 procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
004000 end method.
004100
004200 method-id InputClose_Click.
004300 procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
004400 end method.
004500
004600 method-id RestartInput_Click.
004700 procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
004800 end method.
004900
005000 method-id CloseInput_Click.
005100 procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.
005200 invoke self::Close.
005300 end method.
005400
005500 end class.
--------------------------------------------------------------------------------------------