mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-06 07:56:06 +02:00
Recursive sample added for TreeNode iteratation (#1058)
* Non-recursive tree traversal C# sample added * Changed formatting to reflect markdown correctly * Formatting updated * Updated sentence * Update to confirm to ESlint changes * Resolve indentation mismatch * Correctly link the xref * Added C# code snippets for iteration over TreeView * Add reference to c# code snippet * Added a ref to the code snippet for recursive c# * Fix comment * VisualBasic code snippet for TreeViewTraversal * Updated vb reference to code snippet * Cpp gitignore updated * Added cpp snippet for TreeView iteration * C# commenting out print calls * Vb commenting out print calls * Reorder Folder Structure cpp * Document updated with code snippets * C# proj prpgrp updated * VB prpgrp added * Cpp prpgrp added * Fixed typo * Add description, update date * Updating to match the two sections in style * Adding teh snippets.5000.json file * Update dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md * Update dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md Co-authored-by: Andy (Steve) De George <[email protected]>
This commit is contained in:
co-authored by
Andy De George
parent
6ca5ef0da8
commit
9722305b10
+13
@@ -0,0 +1,13 @@
|
||||
#include "MyForm.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Windows::Forms;
|
||||
[STAThreadAttribute]
|
||||
|
||||
void main(array<String^>^ args) {
|
||||
Application::SetCompatibleTextRenderingDefault(false);
|
||||
Application::EnableVisualStyles();
|
||||
project::MyForm frm;
|
||||
Application::Run(%frm);
|
||||
}
|
||||
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
#pragma once
|
||||
#include "Student.h"
|
||||
#include "Subject.h"
|
||||
#include "TextBook.h"
|
||||
|
||||
namespace project {
|
||||
|
||||
using namespace System;
|
||||
using namespace System::ComponentModel;
|
||||
using namespace System::Collections;
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Data;
|
||||
using namespace System::Drawing;
|
||||
|
||||
/// <summary>
|
||||
/// Summary for MyForm
|
||||
/// </summary>
|
||||
public ref class MyForm : public System::Windows::Forms::Form
|
||||
{
|
||||
public:
|
||||
MyForm(void)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
PopulateTreeView();
|
||||
|
||||
//Below method implementations will start printing node values to MessageBoxes and can be time consuming.
|
||||
//An alternate way to check is adding two labels and printing the values of the total nodes in each using both the below traversal methods.
|
||||
|
||||
//CallRecursive(trvTest);
|
||||
|
||||
//CallNonRecursive(trvTest);
|
||||
}
|
||||
|
||||
private:
|
||||
//List of all students
|
||||
ArrayList^ studentArray = gcnew ArrayList();
|
||||
|
||||
void PopulateTreeView()
|
||||
{
|
||||
// Add students to the ArrayList of Student objects.
|
||||
for (int x = 0; x < 5; x++)
|
||||
{
|
||||
studentArray->Add(gcnew Student("Student " + x.ToString()));
|
||||
}
|
||||
|
||||
// Add subjects to each Student object in the ArrayList.
|
||||
for(int x = 0; x < 5; x++)
|
||||
{
|
||||
for (int y = 0; y < 10; y++)
|
||||
{
|
||||
safe_cast<Student^>(studentArray[x])->StudentSubjects->Add(gcnew Subject("Subject " + y.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Add subjects to each Student object in the ArrayList.
|
||||
for (int x = 0; x < 5; x++)
|
||||
{
|
||||
for (int y = 0; y < 10; y++)
|
||||
{
|
||||
for (int z = 0; z < 3; z++)
|
||||
{
|
||||
safe_cast<Subject^>(safe_cast<Student^>(studentArray[x])->StudentSubjects[y])->SubjectTextbooks->Add(gcnew TextBook("TextBook " + z.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppress repainting the TreeView until all the objects have been created.
|
||||
trvTest->BeginUpdate();
|
||||
|
||||
// Clear the TreeView each time the method is called.
|
||||
trvTest->Nodes->Clear();
|
||||
|
||||
System::Collections::IEnumerator^ studArray = (safe_cast<System::Collections::IEnumerable^>(studentArray))->GetEnumerator();
|
||||
|
||||
// Add a root TreeNode for each Student object in the ArrayList.
|
||||
while (studArray->MoveNext())
|
||||
{
|
||||
trvTest->Nodes->Add(gcnew TreeNode(safe_cast<Student^>(studArray->Current)->StudentName));
|
||||
|
||||
System::Collections::IEnumerator^ studSubjects = (safe_cast<System::Collections::IEnumerable^>(safe_cast<Student^>(studArray->Current)->StudentSubjects))->GetEnumerator();
|
||||
|
||||
while (studSubjects->MoveNext())
|
||||
{
|
||||
trvTest->Nodes[studentArray->IndexOf(safe_cast<Student^>(studArray->Current))]->Nodes->Add(gcnew TreeNode(safe_cast<Subject^>(studSubjects->Current)->SubjectID));
|
||||
|
||||
System::Collections::IEnumerator^ subTextbooks = (safe_cast<System::Collections::IEnumerable^>(safe_cast<Subject^>(studSubjects->Current)->SubjectTextbooks))->GetEnumerator();
|
||||
|
||||
while (subTextbooks->MoveNext())
|
||||
{
|
||||
trvTest->Nodes[studentArray->IndexOf(safe_cast<Student^>(studArray->Current))]->Nodes[safe_cast<Student^>(studArray->Current)->StudentSubjects->IndexOf(safe_cast<Subject^>(studSubjects->Current))]->Nodes->Add(gcnew TreeNode(safe_cast<TextBook^>(subTextbooks->Current)->TextBookID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Begin repainting the TreeView.
|
||||
trvTest->EndUpdate();
|
||||
}
|
||||
|
||||
// <PrintRecursive>
|
||||
private:
|
||||
void PrintRecursive(TreeNode^ treeNode)
|
||||
{
|
||||
// Print the node.
|
||||
System::Diagnostics::Debug::WriteLine(treeNode->Text);
|
||||
MessageBox::Show(treeNode->Text);
|
||||
|
||||
// Print each node recursively.
|
||||
System::Collections::IEnumerator^ myNodes = (safe_cast<System::Collections::IEnumerable^>(treeNode->Nodes))->GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (myNodes->MoveNext())
|
||||
{
|
||||
TreeNode^ tn = safe_cast<TreeNode^>(myNodes->Current);
|
||||
PrintRecursive(tn);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
delete(myNodes);
|
||||
}
|
||||
}
|
||||
|
||||
// Call the procedure using the TreeView.
|
||||
void CallRecursive(TreeView^ treeView)
|
||||
{
|
||||
// Print each node recursively.
|
||||
TreeNodeCollection^ nodes = treeView->Nodes;
|
||||
System::Collections::IEnumerator^ myNodes = (safe_cast<System::Collections::IEnumerable^>(nodes))->GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (myNodes->MoveNext())
|
||||
{
|
||||
TreeNode^ n = safe_cast<TreeNode^>(myNodes->Current);
|
||||
PrintRecursive(n);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
delete(myNodes);
|
||||
}
|
||||
}
|
||||
// </PrintRecursive>
|
||||
|
||||
// <PrintNonRecursive>
|
||||
private:
|
||||
void PrintNonRecursive(TreeNode^ treeNode)
|
||||
{
|
||||
//Using a queue to store and process each node in the TreeView
|
||||
Queue^ staging = gcnew Queue();
|
||||
staging->Enqueue(treeNode);
|
||||
while (staging->Count > 0)
|
||||
{
|
||||
treeNode = safe_cast<TreeNode^>(staging->Dequeue());
|
||||
|
||||
// Print the node.
|
||||
System::Diagnostics::Debug::WriteLine(treeNode->Text);
|
||||
MessageBox::Show(treeNode->Text);
|
||||
|
||||
System::Collections::IEnumerator^ children = (safe_cast<System::Collections::IEnumerable^>(treeNode->Nodes))->GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (children->MoveNext())
|
||||
{
|
||||
staging->Enqueue(children->Current);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
delete(children);
|
||||
}
|
||||
}
|
||||
|
||||
// Print the node.
|
||||
System::Diagnostics::Debug::WriteLine(treeNode->Text);
|
||||
MessageBox::Show(treeNode->Text);
|
||||
|
||||
// Print each node recursively.
|
||||
System::Collections::IEnumerator^ myNodes = (safe_cast<System::Collections::IEnumerable^>(treeNode->Nodes))->GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (myNodes->MoveNext())
|
||||
{
|
||||
TreeNode^ tn = safe_cast<TreeNode^>(myNodes->Current);
|
||||
PrintRecursive(tn);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
delete(myNodes);
|
||||
}
|
||||
}
|
||||
|
||||
// Call the procedure using the TreeView.
|
||||
void CallNonRecursive(TreeView^ treeView)
|
||||
{
|
||||
// Print each node recursively.
|
||||
TreeNodeCollection^ nodes = treeView->Nodes;
|
||||
System::Collections::IEnumerator^ myNodes = (safe_cast<System::Collections::IEnumerable^>(nodes))->GetEnumerator();
|
||||
try
|
||||
{
|
||||
while (myNodes->MoveNext())
|
||||
{
|
||||
TreeNode^ n = safe_cast<TreeNode^>(myNodes->Current);
|
||||
PrintNonRecursive(n);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
delete(myNodes);
|
||||
}
|
||||
}
|
||||
// </PrintNonRecursive>
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
~MyForm()
|
||||
{
|
||||
if (components)
|
||||
{
|
||||
delete components;
|
||||
}
|
||||
}
|
||||
private: System::Windows::Forms::TreeView^ trvTest;
|
||||
protected:
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
System::ComponentModel::Container ^components;
|
||||
|
||||
#pragma region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
void InitializeComponent(void)
|
||||
{
|
||||
this->trvTest = (gcnew System::Windows::Forms::TreeView());
|
||||
this->SuspendLayout();
|
||||
//
|
||||
// trvTest
|
||||
//
|
||||
this->trvTest->Location = System::Drawing::Point(12, 12);
|
||||
this->trvTest->Name = L"trvTest";
|
||||
this->trvTest->Size = System::Drawing::Size(474, 396);
|
||||
this->trvTest->TabIndex = 0;
|
||||
//
|
||||
// MyForm
|
||||
//
|
||||
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
|
||||
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
||||
this->ClientSize = System::Drawing::Size(498, 420);
|
||||
this->Controls->Add(this->trvTest);
|
||||
this->Name = L"MyForm";
|
||||
this->Text = L"MyForm";
|
||||
this->ResumeLayout(false);
|
||||
|
||||
}
|
||||
#pragma endregion
|
||||
};
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
namespace project {
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections;
|
||||
public ref class Student
|
||||
{
|
||||
private:
|
||||
ArrayList^ _studentSubjects = gcnew ArrayList();
|
||||
public:
|
||||
String^ StudentName = "";
|
||||
|
||||
ArrayList^ StudentSubjects = _studentSubjects;
|
||||
|
||||
Student(String^ studentName)
|
||||
{
|
||||
StudentName = studentName;
|
||||
}
|
||||
};
|
||||
};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
namespace project {
|
||||
using namespace System;
|
||||
using namespace System::Collections;
|
||||
|
||||
public ref class Subject
|
||||
{
|
||||
private:
|
||||
ArrayList^ _subjectTextbooks = gcnew ArrayList();
|
||||
public:
|
||||
String^ SubjectID = "";
|
||||
|
||||
ArrayList^ SubjectTextbooks = _subjectTextbooks;
|
||||
|
||||
Subject(String^ subjectID)
|
||||
{
|
||||
SubjectID = subjectID;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
namespace project {
|
||||
using namespace System;
|
||||
using namespace System::Collections;
|
||||
|
||||
public ref class TextBook
|
||||
{
|
||||
public:
|
||||
String^ TextBookID = "";
|
||||
|
||||
TextBook(String^ textBookID)
|
||||
{
|
||||
TextBookID = textBookID;
|
||||
}
|
||||
};
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{A443B067-F8C3-4DFD-9F38-E6C840918865}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>project</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
|
||||
<GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="MyForm.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MyForm.h">
|
||||
<FileType>CppForm</FileType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Student.h" />
|
||||
<ClInclude Include="Subject.h" />
|
||||
<ClInclude Include="TextBook.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="MyForm.resx">
|
||||
<DependentUpon>MyForm.h</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="MyForm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MyForm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Student.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Subject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TextBook.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"host": "visualstudio"
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
|
||||
namespace project
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.trvTest = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// trvTest
|
||||
//
|
||||
this.trvTest.Location = new System.Drawing.Point(12, 12);
|
||||
this.trvTest.Name = "trvTest";
|
||||
this.trvTest.Size = new System.Drawing.Size(578, 426);
|
||||
this.trvTest.TabIndex = 0;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(598, 451);
|
||||
this.Controls.Add(this.trvTest);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TreeView trvTest;
|
||||
}
|
||||
}
|
||||
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace project
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
//List of all students
|
||||
private ArrayList studentArray = new ArrayList();
|
||||
|
||||
//Windows Form application
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//Loading the TreeView with data
|
||||
PopulateTreeView();
|
||||
|
||||
//Below method implementations will start printing node values to MessageBoxes and can be time consuming.
|
||||
//An alternate way to check is adding two labels and printing the values of the total nodes in each using both the below traversal methods.
|
||||
|
||||
//Printing the total number of nodes recursively
|
||||
//CallRecursive(trvTest);
|
||||
|
||||
//CallNonRecursive(trvTest);
|
||||
}
|
||||
|
||||
// <PrintRecursive>
|
||||
private void PrintRecursive(TreeNode treeNode)
|
||||
{
|
||||
// Print the node.
|
||||
System.Diagnostics.Debug.WriteLine(treeNode.Text);
|
||||
MessageBox.Show(treeNode.Text);
|
||||
|
||||
// Visit each node recursively.
|
||||
foreach (TreeNode tn in treeNode.Nodes)
|
||||
{
|
||||
PrintRecursive(tn);
|
||||
}
|
||||
}
|
||||
|
||||
// Call the procedure using the TreeView.
|
||||
private void CallRecursive(TreeView treeView)
|
||||
{
|
||||
// Print each node recursively.
|
||||
foreach (TreeNode n in treeView.Nodes)
|
||||
{
|
||||
//recursiveTotalNodes++;
|
||||
PrintRecursive(n);
|
||||
}
|
||||
}
|
||||
// </PrintRecursive>
|
||||
|
||||
// <PrintNonRecursive>
|
||||
private void PrintNonRecursive(TreeNode treeNode)
|
||||
{
|
||||
if (treeNode != null)
|
||||
{
|
||||
//Using a queue to store and process each node in the TreeView
|
||||
Queue<TreeNode> staging = new Queue<TreeNode>();
|
||||
staging.Enqueue(treeNode);
|
||||
|
||||
while (staging.Count > 0)
|
||||
{
|
||||
treeNode = staging.Dequeue();
|
||||
|
||||
// Print the node.
|
||||
System.Diagnostics.Debug.WriteLine(treeNode.Text);
|
||||
MessageBox.Show(treeNode.Text);
|
||||
|
||||
foreach (TreeNode node in treeNode.Nodes)
|
||||
{
|
||||
staging.Enqueue(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call the procedure using the TreeView.
|
||||
private void CallNonRecursive(TreeView treeView)
|
||||
{
|
||||
// Print each node.
|
||||
foreach (TreeNode n in treeView.Nodes)
|
||||
{
|
||||
PrintNonRecursive(n);
|
||||
}
|
||||
}
|
||||
// </PrintNonRecursive>
|
||||
|
||||
private void PopulateTreeView()
|
||||
{
|
||||
// Add students to the ArrayList of Student objects.
|
||||
for (int x = 0; x < 5; x++)
|
||||
{
|
||||
studentArray.Add(new Student("Student " + x.ToString()));
|
||||
}
|
||||
|
||||
// Add subjects to each Student object in the ArrayList.
|
||||
foreach (Student student in studentArray)
|
||||
{
|
||||
for (int y = 0; y < 10; y++)
|
||||
{
|
||||
student.StudentSubjects.Add(new Subject("Subject " + y.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
Random _random = new Random();
|
||||
|
||||
// Add subjects to each Student object in the ArrayList.
|
||||
foreach (Student student in studentArray)
|
||||
{
|
||||
foreach (Subject subject in student.StudentSubjects)
|
||||
{
|
||||
var gen = _random.Next(1, 10);
|
||||
|
||||
for (int y = 0; y < gen; y++)
|
||||
{
|
||||
subject.SubjectTextbooks.Add(new TextBook("TextBook " + y.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppress repainting the TreeView until all the objects have been created.
|
||||
trvTest.BeginUpdate();
|
||||
|
||||
// Clear the TreeView each time the method is called.
|
||||
trvTest.Nodes.Clear();
|
||||
|
||||
// Add a root TreeNode for each Student object in the ArrayList.
|
||||
foreach (Student student in studentArray)
|
||||
{
|
||||
trvTest.Nodes.Add(new TreeNode(student.StudentName));
|
||||
|
||||
// Add a child treenode for each Subject object in the current student object.
|
||||
foreach (Subject subject in student.StudentSubjects)
|
||||
{
|
||||
trvTest.Nodes[studentArray.IndexOf(student)].Nodes.Add(
|
||||
new TreeNode(subject.SubjectID));
|
||||
|
||||
// Add a child treenode for each TextBook object in the current Subject object.
|
||||
|
||||
foreach (TextBook textbook in subject.SubjectTextbooks)
|
||||
{
|
||||
trvTest.Nodes[studentArray.IndexOf(student)].Nodes[student.StudentSubjects.IndexOf(subject)].Nodes.Add(
|
||||
new TreeNode(textbook.TextBookID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Begin repainting the TreeView.
|
||||
trvTest.EndUpdate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace project
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace project
|
||||
{
|
||||
// The basic Student class.
|
||||
public class Student
|
||||
{
|
||||
protected ArrayList _studentSubjects = new ArrayList();
|
||||
|
||||
public Student(string studentName)
|
||||
{
|
||||
StudentName = studentName;
|
||||
}
|
||||
|
||||
public string StudentName { get; set; } = "";
|
||||
|
||||
public ArrayList StudentSubjects => _studentSubjects;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace project
|
||||
{
|
||||
// The basic student Subject class.
|
||||
public class Subject
|
||||
{
|
||||
protected ArrayList _subjectTextbooks = new ArrayList();
|
||||
|
||||
public Subject(string subjectID)
|
||||
{
|
||||
SubjectID = subjectID;
|
||||
}
|
||||
|
||||
public string SubjectID { get; set; } = "";
|
||||
|
||||
public ArrayList SubjectTextbooks => _subjectTextbooks;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace project
|
||||
{
|
||||
public class TextBook
|
||||
{
|
||||
|
||||
public TextBook(string textBookID)
|
||||
{
|
||||
TextBookID = textBookID;
|
||||
}
|
||||
|
||||
public string TextBookID { get; set; } = "";
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{50B5AD53-1181-46C6-91EE-0E65BADF34E1}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>project</RootNamespace>
|
||||
<AssemblyName>project</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
|
||||
<GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Student.cs" />
|
||||
<Compile Include="Subject.cs" />
|
||||
<Compile Include="TextBook.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class Form1
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.trvTest = New System.Windows.Forms.TreeView()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.Label2 = New System.Windows.Forms.Label()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'trvTest
|
||||
'
|
||||
Me.trvTest.Location = New System.Drawing.Point(12, 28)
|
||||
Me.trvTest.Name = "trvTest"
|
||||
Me.trvTest.Size = New System.Drawing.Size(413, 410)
|
||||
Me.trvTest.TabIndex = 0
|
||||
'
|
||||
'Label1
|
||||
'
|
||||
Me.Label1.AutoSize = True
|
||||
Me.Label1.Location = New System.Drawing.Point(538, 65)
|
||||
Me.Label1.Name = "Label1"
|
||||
Me.Label1.Size = New System.Drawing.Size(51, 17)
|
||||
Me.Label1.TabIndex = 1
|
||||
Me.Label1.Text = "Label1"
|
||||
'
|
||||
'Label2
|
||||
'
|
||||
Me.Label2.AutoSize = True
|
||||
Me.Label2.Location = New System.Drawing.Point(538, 104)
|
||||
Me.Label2.Name = "Label2"
|
||||
Me.Label2.Size = New System.Drawing.Size(51, 17)
|
||||
Me.Label2.TabIndex = 2
|
||||
Me.Label2.Text = "Label2"
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.Label2)
|
||||
Me.Controls.Add(Me.Label1)
|
||||
Me.Controls.Add(Me.trvTest)
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Form1"
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
|
||||
Friend WithEvents trvTest As TreeView
|
||||
Friend WithEvents Label1 As Label
|
||||
Friend WithEvents Label2 As Label
|
||||
End Class
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
Imports project.project
|
||||
|
||||
Public Class Form1
|
||||
Private studentArray As ArrayList = New ArrayList()
|
||||
|
||||
Public Sub New()
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
'Loading the TreeView with data
|
||||
PopulateTreeView()
|
||||
|
||||
'Below method implementations will start printing node values to MessageBoxes and can be time consuming.
|
||||
'An alternate way to check is adding two labels and printing the values of the total nodes in each using both the below traversal methods.
|
||||
|
||||
'Print all the nodes recursively
|
||||
'CallRecursive(trvTest)
|
||||
'CallNonRecursive(trvTest)
|
||||
End Sub
|
||||
|
||||
'<PrintRecursive>
|
||||
Private Sub PrintRecursive(n As TreeNode)
|
||||
System.Diagnostics.Debug.WriteLine(n.Text)
|
||||
MessageBox.Show(n.Text)
|
||||
Dim aNode As TreeNode
|
||||
For Each aNode In n.Nodes
|
||||
PrintRecursive(aNode)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Call the procedure using the top nodes of the treeview.
|
||||
Private Sub CallRecursive(aTreeView As TreeView)
|
||||
Dim n As TreeNode
|
||||
For Each n In aTreeView.Nodes
|
||||
PrintRecursive(n)
|
||||
Next
|
||||
End Sub
|
||||
'</PrintRecursive>
|
||||
|
||||
'<PrintNonRecursive>
|
||||
Private Sub PrintNonrecursive(n As TreeNode)
|
||||
If n IsNot Nothing Then
|
||||
Dim staging As Queue(Of TreeNode) = New Queue(Of TreeNode)
|
||||
staging.Enqueue(n)
|
||||
While staging.Count > 0
|
||||
n = staging.Dequeue()
|
||||
|
||||
'Print the node.
|
||||
System.Diagnostics.Debug.WriteLine(n.Text)
|
||||
MessageBox.Show(n.Text)
|
||||
|
||||
Dim node As TreeNode
|
||||
For Each node In n.Nodes
|
||||
staging.Enqueue(node)
|
||||
Next
|
||||
End While
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CallNonRecursive(aTreeView As TreeView)
|
||||
Dim n As TreeNode
|
||||
For Each n In aTreeView.Nodes
|
||||
PrintNonrecursive(n)
|
||||
Next
|
||||
End Sub
|
||||
'</PrintNonRecursive>
|
||||
|
||||
Private Sub PopulateTreeView()
|
||||
For x As Integer = 0 To 4
|
||||
studentArray.Add(New Student("Student " & x.ToString()))
|
||||
Next
|
||||
|
||||
For Each student As Student In studentArray
|
||||
|
||||
For y As Integer = 0 To 9
|
||||
student.StudentSubjects.Add(New Subject("Subject " & y.ToString()))
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim _random As Random = New Random()
|
||||
|
||||
For Each student As Student In studentArray
|
||||
|
||||
For Each subject As Subject In student.StudentSubjects
|
||||
Dim gen = _random.[Next](1, 10)
|
||||
|
||||
For y As Integer = 0 To gen - 1
|
||||
subject.SubjectTextbooks.Add(New TextBook("TextBook " & y.ToString()))
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
|
||||
trvTest.BeginUpdate()
|
||||
trvTest.Nodes.Clear()
|
||||
|
||||
For Each student As Student In studentArray
|
||||
trvTest.Nodes.Add(New TreeNode(student.StudentName))
|
||||
|
||||
For Each subject As Subject In student.StudentSubjects
|
||||
trvTest.Nodes(studentArray.IndexOf(student)).Nodes.Add(New TreeNode(subject.SubjectID))
|
||||
|
||||
For Each textbook As TextBook In subject.SubjectTextbooks
|
||||
trvTest.Nodes(studentArray.IndexOf(student)).Nodes(student.StudentSubjects.IndexOf(subject)).Nodes.Add(New TreeNode(textbook.TextBookID))
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
|
||||
trvTest.EndUpdate()
|
||||
End Sub
|
||||
End Class
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
|
||||
' or if you encounter build errors in this file, go to the Project Designer
|
||||
' (go to Project Properties or double-click the My Project node in
|
||||
' Solution Explorer), and make changes on the Application tab.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.project.Form1
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Form1</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>0</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("project")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("project")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("39e4cebe-c608-4771-bef2-d60369ba682f")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("project.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.project.My.MySettings
|
||||
Get
|
||||
Return Global.project.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
Namespace project
|
||||
Public Class Student
|
||||
Protected _studentSubjects As ArrayList = New ArrayList()
|
||||
|
||||
Public Sub New(studentName As String)
|
||||
Me.StudentName = studentName
|
||||
End Sub
|
||||
|
||||
Public Property StudentName As String = ""
|
||||
|
||||
Public ReadOnly Property StudentSubjects As ArrayList
|
||||
Get
|
||||
Return _studentSubjects
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
Namespace project
|
||||
Public Class Subject
|
||||
Protected _subjectTextbooks As ArrayList = New ArrayList()
|
||||
|
||||
Public Sub New(ByVal subjectID As String)
|
||||
Me.SubjectID = subjectID
|
||||
End Sub
|
||||
|
||||
Public Property SubjectID As String = ""
|
||||
|
||||
Public ReadOnly Property SubjectTextbooks As ArrayList
|
||||
Get
|
||||
Return _subjectTextbooks
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
Namespace project
|
||||
Public Class TextBook
|
||||
Public Sub New(textBookID As String)
|
||||
Me.TextBookID = textBookID
|
||||
End Sub
|
||||
|
||||
Public Property TextBookID As String = ""
|
||||
End Class
|
||||
End Namespace
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{294C4A08-390D-4D86-9D54-0A22DC730AB3}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>project.My.MyApplication</StartupObject>
|
||||
<RootNamespace>project</RootNamespace>
|
||||
<AssemblyName>project</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>project.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>project.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateResourceMSBuildArchitecture>CurrentArchitecture</GenerateResourceMSBuildArchitecture>
|
||||
<GenerateResourceMSBuildRuntime>CurrentRuntime</GenerateResourceMSBuildRuntime>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.vb">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Student.vb" />
|
||||
<Compile Include="Subject.vb" />
|
||||
<Compile Include="TextBook.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user