cgeier 187 Junior Poster

There doesn't seem to be a mechanism for changing the question (such as a button). As is, it always loads the first question from the table in the database dt.Rows(0).... To change the question, change '0' to another row number. A basic way to do this is to use two buttons ("Next" and "Previous"). Use a counter variable to keep track of the current question number. Increment this value when the "Next" button is pressed--decrement the value when the "Previous" button is pressed.

What do you want to do when you get to the last question and the user clicks the "Next" button?
What do you want to do when you get to the first question and the user clicks the "Previous" button?

Why do you have 6 tables with the exact same fields?

cgeier 187 Junior Poster

How do you have "myPics" defined?

cgeier 187 Junior Poster

After line 126, add the following (for troubleshooting purposes):

string msg = string.Empty;
msg += "x: " + x.ToString() + System.Environment.NewLine;
msg += "y: " + y.ToString() + System.Environment.NewLine;
msg += "SHOT: " + SHOT.ToString() + System.Environment.NewLine;
msg += "GOALIE: " + GOALIE.ToString() + System.Environment.NewLine;
msg += "picPlay Length is " + picPlay.Length  + " -- Index numbers are 0 to " + (picPlay.Length - 1) + System.Environment.NewLine;

MessageBox.Show(msg, "Values");

What is the value of "SHOT"? Where is this value set?

Also, line 67 you have for (int i = 0; i < 6; i++) which should be i < 5.

cgeier 187 Junior Poster

Have you considered using an int array of size 10 and initializing each element to 0? Index 0 would keep track of the number of times the number 0 occurs. Index 1 would keep track of the number of times the number 1 occurs...etc.

Break what you are trying to do into smaller pieces. Try searching for the following:

  • java loop through string
  • convert character to int
cgeier 187 Junior Poster

In "Main.cpp", line 63 should be cout << "Number inserted:" << num << endl;

In "Main.cpp", there are multiple problems with "ProcessMenu".

  • No "do" for the while statement
  • case1 should be case 1 (you need a space between the word "case" and the number 1)
  • In "ShowMenu" you offer an option to print, but don't have a case statement for it in "ProcessMenu"
  • You don't offer an option to quit

Try the following for ShowMenu:

int ShowMenu(void)
{
    int option;
    cout << "\n\t" << endl;
    cout << "\t\t===============================" << endl;
    cout << "\t\t1. Insert into tree" << endl;
    cout << "\t\t2. Print tree" << endl;
    cout << "\t\t3. Quit" << endl;
    cout << "\t\t===============================" << endl;
    cout << endl;

    cout << "Choose an option: ";

    cin >> option;
    return option;
}//ShowMenu

Try the following for "ProcessMenu":

void ProcessMenu(TreeType<T>& tree)
{
    bool quit = false;
    do{
        switch (ShowMenu())
        {
            case 1:
                InsertItem(tree);
                break;
            case 2: 
                PrintTree(tree);
                break;
            case 3:
                quit = true;
                break;
            default:
                cout << "Error: Invalid option. Try again." << endl;
        }//switch
    } while (!quit);

}//ProcessMenu
cgeier 187 Junior Poster

It's been a while since I've written anything in Perl, but one way of doing it would be to use two arrays--storing all of the "rsId" values in one array and all of the "buildId" values in the other array. Then print all of the "rsId" values separated by a comma and then all of the "buildId" values separated by a comma.

The following may be useful:
Perl string array - How to create and use an array of strings
See "Perl string array - another way to create a list of pizzas"

cgeier 187 Junior Poster

There is an interface for creating databases.

If using the Express version:
* Click "View" (in menu)
* Select "Object Explorer"
* Click the "+" sign next to your database instance (or double-click your database instance name)
* Click the "+" sign next to "Databases" to expand Databases (or double-click "Databases")
* Right-click "Databases" and select "New Database" to create a new database.

Note: You can use a version of SQL Management studio >= to the version of SQL Server/SQL Server Express that you are using (ie: you can use version SQL Server 2008 and SQL Server Management Studio 2012). The steps should be similar for the regular version of SQL Server Management studio.

The following may be helpful:

Tutorial: SQL Server Management Studio

Microsoft® SQL Server® 2008 Management Studio Express

Microsoft® SQL Server® 2012 Express / Microsoft SQL Server 2012 Management Studio Express --expand "Details" to learn more

cgeier 187 Junior Poster

If this only happens when using under battery power, it could be a bug in the video driver, the video chip, or a bug in the OS. You may consider opening a case with HP, although there may be a fee involved. You can download the latest Intel video driver from the Intel website. However, if you open a case with HP, they will most likely insist that you download the latest driver from the HP website, which may or may not actually be the latest driver, but rather the last driver that they've tested on that model of computer. As a work-around, you can try changing some of the power settings. See http://windows.microsoft.com/en-us/windows7/products/features/power-management . I don't have access to a computer right now, but look for any settings for video--can't remember, at the moment, if there are any. Can also try changing the processor minimum (on battery) to a higher number. Start with 100% and see if the issue still occurs.

cgeier 187 Junior Poster

What code did you use to create the XML file?

cgeier 187 Junior Poster

Do I need to dispose/close XDocument.Load(string)?

"No, you don't - it doesn't even implement IDisposable. The XDocument and XElement classes use XmlReader under the covers and handle the disposing of the underlying reader for you."

Using Statement (Visual Basic)

"...Managed resources are disposed of by the .NET Framework garbage collector (GC) without any extra coding on your part. You do not need a Using block for managed resources. However, you can still use a Using block to force the disposal of a managed resource instead of waiting for the garbage collector.

A Using block has three parts: acquisition, usage, and disposal.

Acquisition means creating a variable and initializing it to refer to the system resource. The Using statement can acquire one or more resources, or you can acquire exactly one resource before entering the block and supply it to the Using statement. If you supply resourceexpression, you must acquire the resource before passing control to the Using statement.

Usage means accessing the resources and performing actions with them. The statements between Using and End Using represent the usage of the resources.

Disposal means calling the Dispose method on the object in resourcename. This allows the object to cleanly terminate its resources. The End Using statement disposes of the resources under the Using block's control..."

cgeier 187 Junior Poster

The Community Center Chat window keeps appearing (opening) after I close it which is rather annoying.

cgeier 187 Junior Poster

There is a tutorial on how to use BackgroundWorker here:
How to use BackGroundWorker to Create Threads

It is for VB .NET, but can easily be converted.

cgeier 187 Junior Poster

Also, your program should do some sort of input validation. For example, if your grade point scale is from 0.0 - 4.0, if a user enters "5.0", the program should let the user know that he/she entered an invalid value and should prompt the user to enter a valid value.

cgeier 187 Junior Poster

Start off by writing some pseudo code. See attached file.

Then, convert pseudo code to Java code. The following examples use the pseudo code from the attached file.

Example 1:
Create array to hold course names (Data type: String[]; Variable name: courseNameArr)

Code:

String[] courseNameArr = null;

Example 2:
Create variable to hold total grade points (Data type: double; Variable name: totalGradePoints)

Code:

double totalGradePoints = 0.0;

Example 3:
Initialize course name array (courseNameArr = new String[numcourses])

Code:

courseNameArr = new String[numcourses];

Example 4:
Store course name in course name array (courseNameArr[i])

Code:

courseNameArr[i] = coursecde;

I've left the formulas blank to give you an opportunity to come up with your own formulas.

cgeier 187 Junior Poster

You prompt the user for the number of courses taken (numcourses), but don't use that information. Instead you hardcoded a value of "3". Look at every place you've placed a "3" and ask yourself if perhaps that value should be replaced by "numcourses". Also, what is the purpose of a loop? Lines 93-99 should probably also be in a loop. This type of information would be perfect to be in it's own class. Have you learned about creating your own class yet? If not, then use multiple arrays as you have done.

cgeier 187 Junior Poster

Have you tried adding txtStatus.Refresh(); after txtStatus.Text += ...?

cgeier 187 Junior Poster

Please post your code for "Form1.cs". It looks like it should contain an instance of "VEntradas" and something that sets the value of "entradas" for the instance.

example code in Form1.cs:

VEntradas myVEntradas = new VEntradas();

myVEntradas.entradas = "Armazem";

myVentradas.ShowDialog();

Also, if you aren't going to set an initial value for "entrada", you don't need to do the following:

private string entrada;

public string entradas
{
    get { return entrada; }
    set { entrada = value; }
} 

You can just do the following:

public string entradas { get; set; }

Also, you have:

Home.okLogin = true;

        ...

Home frn = new Home();

which should probably be:

Home frn = new Home();

        ...

Home.okLogin = true;

even if "okLogin" is defined as static--it makes your code easier to follow.

"ContextMenuStrip" may be of use in your program as well.

cgeier 187 Junior Poster

An instance constructor is used to create an instance of a class. In C# it isn't necessary to create a default constructor that is empty. What do I mean by "a default constructor that is empty"?

Let's look at some of the code from above:

class MyCalculations 
{
    public MyCalculations()
    {
    }//default constructor

    public int SumIt(int total)
    {
          ...

    }//SumIt

}//class

Since the constructor is empty--doesn't contain any code--it isn't necessary to specify it. C# automatically includes a default (empty) constructor.

The above class can be written like this:

class MyCalculations 
{        
    public int SumIt(int total)
    {
          ...

    }//SumIt

}//class

However, once you define another constructor C# no longer automatically includes the default (empty) constructor, so you need to include it if you want it in your class.

Resources:

Instance Constructors (C# Programming Guide)

"...If a class does not have a constructor, a default constructor is automatically generated and default values are used to initialize the object fields..."

Static Classes and Static Class Members (C# Programming Guide)

cgeier 187 Junior Poster

Have you considered using a database? Are you trying to store all of the objects into a single file? How many records (entries) do you anticipate having for each object?

cgeier 187 Junior Poster

Do something like this is only appropriate in a business setting on computers the business owns and only when this has been specified as a requirement. Whereas, only allowing a single instance of an application to run is appropriate on any computer.

cgeier 187 Junior Poster

It is probably the "." you have between "EqualsIgnoreCase" and "("

cgeier 187 Junior Poster
cgeier 187 Junior Poster

Maybe next week's lesson from your professor is how to fix it?

You might try researching the following:
-WinPE
-bcdedit
-bootrec

cgeier 187 Junior Poster
cgeier 187 Junior Poster

To clarify my previous post, convert the DateTimePicker value using format as in my previous post.

cgeier 187 Junior Poster

http://stackoverflow.com/questions/12270816/datetime-format-issue-in-vb-net-with-ms-access-database-when-using-sql-statement

You should use:
CurrentDate=Format(TrDate, "yyyy/MM/dd hh:mm:ss tt")

Access needs an unambiguous date.

cgeier 187 Junior Poster

This article may be of use:
No post, no beeps, no video

What is the brand/model of your mb? Does your case have a speaker?
Do you have all of the power connections hooked up (including the 4-pin connector)?

cgeier 187 Junior Poster

Replace the '/' between yyyy and hh and it may work. It looks like your database design could use some work. Is this a theoretical resort (ie: homework assgmt) or a real place. After looking through your project I had difficulty figuring out where swimming type comes into play. Can ppl just visit to use the pool/beach and pay a small fee? Is there an extra fee for additional people when renting a cottage/room?

cgeier 187 Junior Poster

The value in currentItem.SubItems(checkinIndex).Text is not something that can be converted to DateTime, because it either isn't a Date/Time or isn't in a format that is recognizable to DateTime.Parse

cgeier 187 Junior Poster

Have you checked the volume shadow copy settings?

-Click Start
-Select Control Panel (view by: small icons)
-Click System
-Click System Protection (left menu)
-Click System Protection tab
-Click Configure button
-Under "Disk Space Usage", look at Current Usage

cgeier 187 Junior Poster

Are there any beep codes? Since you've replaced parts it may or may not be the same issue, but rather giving similar symptoms. Double check that you properly connected the wires from the case to the mb--check the diagram in the mb documentation. Ensure the processor is properly seated. Ensure the memory is properly seated. Ensure no usb devices are connected and try booting. If not successful, Unhook all unnecessary devices. Only mb, memory, and monitor connected. No keyboard, mouse, cd/dvd drive, hard drive, etc.

cgeier 187 Junior Poster

Also, you should Use Parameterized Queries to Avoid SQL Injection Attacks

For example, in "frmAdmin" (btnSave_Click) you have the following code:

Dim cmdsave As New OleDbCommand("INSERT INTO Room(id,Room_Name,Available,Quantity,Price)" & _
                                "VALUES('" & txtid.Text & "','" & txtname.Text & "'," & _
                                " '" & txtquantity.Text & "','" & txtquantity.Text & "','" & txtprice.Text & "')", conn)

cmdsave.ExecuteNonQuery()

to change to use parameterized queries, do the following:

Dim cmdsave As New OleDbCommand("INSERT INTO Room(id,Room_Name,Available,Quantity,Price)" & _
                                        "VALUES(@id, @Room_Name, @Available, @Quantity, @Price", conn)

Then add the parameters using one of the following methods (versions).

Version 1: (use AddWithValue)

cmdsave.Parameters.AddWithValue("@id", txtid.Text)
cmdsave.Parameters.AddWithValue("@Room_Name", txtname.Text)
cmdsave.Parameters.AddWithValue("@Available", txtquantity.Text)
cmdsave.Parameters.AddWithValue("@Quantity", txtquantity.Text)
cmdsave.Parameters.AddWithValue("@Price", txtprice.Text)

Version 2: (specify data type)

cmdsave.Parameters.Add("@id", OleDbType.VarChar).Value = txtid.Text
cmdsave.Parameters.Add("@Room_Name", OleDbType.VarChar).Value = txtname.Text
cmdsave.Parameters.Add("@Available", OleDbType.VarChar).Value = txtquantity.Text
cmdsave.Parameters.Add("@Quantity", OleDbType.VarChar).Value = txtquantity.Text
cmdsave.Parameters.Add("@Price", OleDbType.VarChar).Value = txtprice.Text

Version 3:

Dim idParam As New OleDbParameter("@id", txtid.Text)
cmdsave.Parameters.Add(idParam)

'do similarly for the other parameters

Version 4:

Dim idParam As New OleDbParameter("@id", OleDbType.VarChar)
idParam.Value = txtid.Text
cmdsave.Parameters.Add(idParam)

'do similarly for the other parameters

There are other ways of adding the parameters, these are just a few.

Then execute:

cmdsave.ExecuteNonQuery()
cgeier 187 Junior Poster

ModuleCustomer contains all the code posted above, and some additional code for initializing a ListView that is new (hasn't been changed using the designer). I included it to show how columns can be added in code rather than in the designer. Additionally, there is some code that adds some rows for testing purposes. It is included for anyone who wishes to download the code and run it without the need of creating a database.

Before going further, if you haven't already done so, I recommend that you turn on line numbering.

In VS, do the following:
-Click "Tools" in menu bar
-Select "Options"
-Expand "Text Editor"
-Expand "All Languages"
-Click "General"
-In right pane, under "Display", check "Line numbers".
-Click "OK"

You can use "Ctl-G" to go to a particular line number. You have the same sub listed starting in line number 109 and line number 128. How did I find that? Use "Ctl-F" to search for "UpdateListViewItemColor". The error "...has multiple definitions with identical signatures" means that you have more than one Sub with the exact same name and same parameter definitions. In this case, you entered the same Sub twice.

Also, the code I posted was created a different version of VS. So there is also the error "Expression expected." This occurs when code spans multiple lines. To fix this add an underscore to the end of each line that continues on the next line.

Change from:

If TimeSpan.Compare(currentTime.TimeOfDay, EveningSwimmingStartTimeDT.TimeOfDay) …
cgeier 187 Junior Poster

This assumes that you already created a form and added a ListView named "ListView1" to it.

First you'll want to add a System.Windows.Forms.Timer to your form.

Open Solution Explorer:
In VS menu strip, do the following:
-Click "View"
-Select "Solution Explorer"

In solution explorer, double-click your form (ex: Form1.vb)

Add Timer to form:
In VS menu strip, do the following:
-Click "View"
-Select "Toolbox"
-Expand "All Windows Forms"
-Double-click "Timer"

You should see "Timer1" below your form. Right-click "Timer1" and select "Properties". Set "Interval" = "1000" -- this is in milliseconds, so 1000 ms = 1 sec. If you want to update every 15 seconds, change this to 15000. Change "Enabled" to "True". Double-click "Timer1" to create the "Tick" event handler. You should now see something like the following:

Public Class Form1

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick

    End Sub

End Class

We'll add some code to "Timer1_Tick" later.

Add module:
In VS menu strip, do the following:
-Click "Project"
-Select "Add Module". Name it "ModuleCustomer.vb"

Module ModuleCustomer

End Module

Add the following variables:

'expired customer color
Private expiredCustomerColor As Color = Color.Red
Private checkinIndex As Integer = 4

'Day Swimming
'year, month, day, hour, minute, seconds
Private DaySwimmingStartTimeDT As DateTime = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0)
Private DaySwimmingEndTimeDT As DateTime = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0)

'Evening Swimming
'year, month, day, hour, minute, seconds
Private …
cgeier 187 Junior Poster

The answer to my question is:

Dim chart1 As New System.Windows.Forms.DataVisualization.Charting.Chart

In order to use it one needs to first be using .NET >= 4. Then a reference needs to be added to System.Windows.Forms.DataVisualization

Add Reference to System.Windows.Forms.DataVisualization:

-Project
-Add Reference
-.NET (tab)
-System.Windows.Forms.DataVisualization

Then add the following "Imports" statement: Imports System.Windows.Forms.DataVisualization

Your issue seems to be on line #29 (line #3 in the original post):
Chart1.Series["Series1"].BorderWidth = 3 should be Chart1.Series("Series1").BorderWidth = 3. VB .NET uses parentheses, not square brackets.

cgeier 187 Junior Poster

The following has been tested with a text file.

public enum OutputGrouping : int
{
    Group1AsciiCodeNewLineSeparated,   //12       - 1 ASCII code per line
    Group1AsciiCodeSpaceSeparated,     //12       - 1 ASCII code, then a space
    Group2AsciiCodesNewLineSeparated,  //1234     - group of 2 ASCII codes per line
    Group4AsciiCodesNewLineSeparated,  //12345678 - group of 4 ASCII codes per line
}//OutputGrouping

ConvertTextFileToASCIICodes:

public static string ConvertTextFileToASCIICodes(string inputFilename, OutputGrouping grouping)
{
    StringBuilder outputSb = new StringBuilder();
    string tempStr = String.Empty;
    string prependStr = String.Empty;
    int position = 0;

    //read file data
    byte[] fileDataArr = System.IO.File.ReadAllBytes(inputFilename);

    for (int i=0; i < fileDataArr.Length; i++)
    {
        //convert to 2-char hex string
        convertedByteStrArr[i] = fileDataArr[i].ToString("X2");

        //group ASCII codes
        switch (grouping)
        {
            case OutputGrouping.Group1AsciiCodeSpaceSeparated:
                //separate ASCII codes by space
                outputSb.Append(convertedByteStrArr[i].ToString() + " ");
                break;

            case OutputGrouping.Group1AsciiCodeNewLineSeparated:
                //separate ASCII codes by NewLine
                outputSb.AppendLine(convertedByteStrArr[i].ToString());
                break;

            case OutputGrouping.Group2AsciiCodesNewLineSeparated:
                //two ASCII codes together followed by a NewLine
                if ((i+1) % 2 == 0)
                {
                    //convert position to 8-char hex string
                    prependStr = position.ToString("X8");

                    //append current ASCII code
                    tempStr += convertedByteStrArr[i].ToString();

                    //prepend with position as 8-char hex string
                    outputSb.AppendLine(prependStr + " " + tempStr);

                    Console.WriteLine("tempStr: " + prependStr + " " + tempStr);

                    //re-initialize
                    tempStr = string.Empty;

                    //set position
                    position = i + 1;
                }//if
                else
                {
                    //append current ASCII code
                    tempStr += convertedByteStrArr[i].ToString();
                }//else

                break;

            case OutputGrouping.Group4AsciiCodesNewLineSeparated:
                //four ASCII codes together followed by a NewLine
                if ((i+1) % 4 == 0)
                {
                    //convert position to 8-char hex string
                    prependStr = position.ToString("X8");

                    //append current ASCII code
                    tempStr += convertedByteStrArr[i].ToString();

                    //prepend with position as 8-char hex string …
cgeier 187 Junior Poster

How is "Chart1" defined? What is it's data type?

cgeier 187 Junior Poster

Here are 3 methods that each accomplish this:

getFolderNameGD (System.IO.Directory.GetDirectories) - version 1:

Public Function getFolderNameGD(ByVal fullyQualifiedFolderName As String, ByVal searchPattern As String)

    'return directory that matches searchPattern
    For Each fqDirName As String In System.IO.Directory.GetDirectories(fullyQualifiedFolderName, searchPattern, System.IO.SearchOption.TopDirectoryOnly)
        Return fqDirName
    Next

    Return String.Empty
End Function

getFolderNameGDI (System.IO.DirectoryInfo) - version 2:

Public Function getFolderNameGDI(ByVal fullyQualifiedFolderName As String, ByVal searchPattern As String)

    Dim di As New System.IO.DirectoryInfo(fullyQualifiedFolderName)
    Dim dirInfoArr() As System.IO.DirectoryInfo = di.GetDirectories(searchPattern, System.IO.SearchOption.TopDirectoryOnly)

    'return directory that matches searchPattern
    For Each d As System.IO.DirectoryInfo In dirInfoArr
        Return d.FullName
    Next

    Return String.Empty
End Function

getFolderNameED (System.IO.EnumerateDirectories) - version 3:

Public Function getFolderNameED(ByVal fullyQualifiedFolderName As String, ByVal propertyNumber As String)

    'return directory that starts with 
    'property number followed by a space and a "-"
    For Each fqDirName As String In System.IO.Directory.EnumerateDirectories(fullyQualifiedFolderName)
        Dim dirName = fqDirName.Replace(System.IO.Path.GetDirectoryName(fqDirName) & "\", "")

        If dirName.Substring(0, dirName.IndexOf("-") - 1) = propertyNumber Then
            'Debug.WriteLine("dirName ED: " & dirName)
            Return fqDirName
        End If
    Next

    Return String.Empty
End Function

Usage:

'version 1
Dim foldernameGD As String = getFolderNameGD("C:\Temp\Revenue Management\Centralized Revenue Management Service\CRMS Hotels", "1504 -*")

'version 2
Dim foldernameGDI As String = getFolderNameGDI("C:\Temp\Revenue Management\Centralized Revenue Management Service\CRMS Hotels", "1504 -*")

'version 3
Dim foldernameED As String = getFolderNameED("C:\Temp\Revenue Management\Centralized Revenue Management Service\CRMS Hotels", "1504")

example folder name: "1504 - FPbs Meriden"

cgeier 187 Junior Poster
Public Function getFolderNameGDI(ByVal fullyQualifiedFolderName As String, ByVal propertyNumber As String)

    'property number followed by a space and a "-"
    Dim searchPattern = propertyNumber & " - " & "*"

    'Debug.WriteLine("searchPattern: '" & searchPattern & "'")

    Dim di As New System.IO.DirectoryInfo(fullyQualifiedFolderName)
    Dim dirInfoArr() As System.IO.DirectoryInfo = di.GetDirectories(searchPattern, System.IO.SearchOption.TopDirectoryOnly)

    'return directory that matches searchPattern
    For Each d As System.IO.DirectoryInfo In dirInfoArr
        'Debug.WriteLine("dirName GD: " & fqDirName)
        Return d.FullName
    Next

    Return String.Empty
End Function
cgeier 187 Junior Poster

Found the following, which may be of use:
Toshiba black screen won't start

..."This is WORKED FOR ME!--->I turned off my computer than unplugged cable and took out battery, held down power button for 1-2mins and than put everything back in (battery and charger) and tried to start it...the screen was still black. I than turned it off again, than pressed ESC, while holding down ESC I pressed and held power button until it briefly turned on and back off. Than I let go of both the buttons and pressed power back on and VOILA the screen came back on. Make sure your charger isn't loose, and than you're aren't surging too much power through the outlets-sometimes these can make the screen black too"...

cgeier 187 Junior Poster

What is the part number for your Nanya memory?

Here's a Kingston KVR1333D3N9K2/8G listing for your computer. It appears to be discontinued, but replaced by Kingston KVR13N9S8K2/8

Also, this Corsair CMV8GX3M2A1333C9 memory may work.

cgeier 187 Junior Poster

Just noticed this is a duplicate post:
Using { get; private set; } to return data to original instance of a form

Please don't post the exact same question under a different title--especially without closing the other one first.

cgeier 187 Junior Poster

Btw, what @deceptikon means is that there shouldn't be any references to "invmain" in "additem". Also, I recommend that you use a more obvious naming strategy. If you do something like the following, it will make your code easier to follow, and also make it easier to find what you are looking for in "Solution Explorer":

Forms:
-FrmAddItem
-FrmCover
-FrmMain

Classes:
-ClsInventoryItem

If you want to use a modal child form (additem), then use "ShowDialog" as @deceptikon showed above. If you want to use a non-modal child form (additem), then use "Show". The tutorial I referenced above uses events and is for use if you use "Show".

Note: There is a slight mistake in the code @deceptikon posted above: if (dlg.ShowDialog == DialogResult.OK) should be if (dlg.ShowDialog() == DialogResult.OK)--the parentheses are missing after "ShowDialog".

What is the difference between "ShowDialog" and "Show"? One of the most noticeable differences (to the user), is that "ShowDialog" won't allow you to return to the main form until you "close" it, whereas using "Show" allows you to keep the child form open and still be able to access other forms in your program.

ShowDialog
When a form is displayed as a modal dialog box, clicking the Close button (the button with an X at the upper-right corner of the form) causes the form to be hidden and the DialogResult property to be set to DialogResult.Cancel. Unlike non-modal forms, the Close method is not called by the .NET Framework …

cgeier 187 Junior Poster

For passing back information (data) through the use of events, see the following tutorial:

How to pass data between two forms in C#

cgeier 187 Junior Poster

I made some modifications to the code above, made "inputFileEncoding" and "outputFileEncoding" properties instead of parameters, added error handling/logging capabilities, and added more documentation.

Need the following imports:
Imports System.IO
Imports System.Text

Add the following to the module:

Public Property InputFileEncoding As Encoding = Encoding.ASCII
Public Property OutputFileEncoding As Encoding = Encoding.ASCII

Public Property LogFilename As String = "RestranLog.txt"

'holds last error message
Private _errMsg As String = String.Empty

'StreamWriter for log file
Private _swLogFile As StreamWriter = Nothing

Private _outputFilename As String = String.Empty

MergeFile:

Private Sub MergeFile(ByVal inputFilename As String, ByVal outputFilename As String, ByVal addFormFeedToFirstPage As Boolean, ByVal removeEndOfReport As Boolean)
    Dim fileDataArr() As String = Nothing
    Dim logMsg As String = String.Empty

    Try
        'read input file data into a string array
        fileDataArr = File.ReadAllLines(inputFilename, InputFileEncoding)

        'add form feed to first page of all files 
        'except the first one addFormFeedToFirstPage 
        'should be set to True for all files except
        'the first one
        If addFormFeedToFirstPage Then
            'Chr(12) is ASCII code 0C or 12
            fileDataArr(0) = Chr(12) & fileDataArr(0)
        End If

        'if necessary, remove lines at end of report - 
        '"End of Report" and some blank lines
        If removeEndOfReport Then
            'resize array removing last 4 elements (lines)
            ReDim Preserve fileDataArr(fileDataArr.Length - 4)
        End If

        'add Newline (carriage return) to each line
        Dim outputDataStr As String = Join(fileDataArr, System.Environment.NewLine)

        'append data to output file
        File.AppendAllText(outputFilename, outputDataStr, OutputFileEncoding)

        'make log file entry
        logMsg = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") & " File: " & inputFilename & " merged to: " & …
cgeier 187 Junior Poster

After reading through some of your posts, I have some suggestions:

Rather than doing this:

        Dim propertyNo As String = "1540"
        Dim propertyNo1 As String = String.Empty
        Dim strLength As Integer = propertyNo.Length

        If strLength = 2 Then
            propertyNo1 = "000" & propertyNo
        End If
        If strLength = 3 Then
            propertyNo1 = "00" & propertyNo
        End If
        If strLength = 4 Then
            propertyNo1 = "0" & propertyNo
        End If
        If strLength = 5 Then
            propertyNo1 = propertyNo
        End If

You can do this:

        Dim propertyNo As String = "1540"
        Dim propertyNo1 As String = String.Empty

        'convert property number to 5 digits
        If IsNumeric(propertyNumber) Then
            'convert propertyNumber to an integer 
            'so it can be converted
            'to a 5-digit string using "ToString"
            propertyNo1 = Convert.ToInt32(propertyNumber).ToString("D5")
        End If

Also, the following code should be all that you need to "merge" your files. Unfortunately, there were some things that I was unable to determine, based on the information that you've provided so far--such as the directory name / filename structure. This would be necessary to determine which parts can be automated and which parts require user input. I was also unable to determine if you want the user to be able to decide which files to merge or which properties to merge. Additionally, I was uncertain if a merged file should only contain information for that particular property, or if more than one property can be part of a single (merged) file.

MergeFile:

Private Sub MergeFile(ByVal inputFilename …
cgeier 187 Junior Poster

After looking over your post "Stopped Working" during routine I did some testing on the file that you posted there "20150228.txt". It appears that the symbol that you happened to see in Notepad, is actually a form feed (ASCII code 12 or 0C).

If using "ReadAllLines", one of the things used to split the lines is a line feed.

The symbol appears at the start of the line that contains "Page Number: 2", "Page Number: 3", etc. If you use a hex editor/viewer to view the file "20150228.txt", you will see the following: 0a0c 466f 7572 or 0a 0c 46 6f 75 72.
If you look up the ASCII codes,
0a = 0A = a = A = line feed/new line
0c = 0C = c = C = form feed/new page
46 = F
6f = o
75 = u
72 = r

Since, "ReadAllLine" split using the line feed (0A), it is no longer present. However, the form feed (0C) is still present, and is now at the beginning of the next line.

Here is the code that can be used to verify this:

    Public Sub ConvertTextToASCIICodes(ByVal inputFilename As String, ByVal inputFileEncoding As Encoding, ByVal outputFilename As String, ByVal outputFileEncoding As Encoding)

        'delete previous output file
        If System.IO.File.Exists(outputFilename) Then
            System.IO.File.Delete(outputFilename)
        End If

        'read input file data into a string array
        Dim fileDataArr() As String = File.ReadAllLines(inputFilename, inputFileEncoding)

        For Each line In fileDataArr
            'Desired symbol (form …
cgeier 187 Junior Poster

It appears that you may be using the wrong encoding when reading and writing the files.

File.ReadAllText Method (String)
...This method attempts to automatically detect the encoding of a file based on the presence of byte order marks...

Byte order mark
...The UTF-8 representation of the BOM is the byte sequence 0xEF, 0xBB, 0xBF...

The following post: What are the differences between Linux and Windows .txt files (Unicode encoding) references some tools that can be used to determine file encoding. I used File for Windows on the original text file you posted (20150228.txt), and it showed "ASCII text". I also used "xxd" (a Cygwin download) which showed the following: 466f757220506f696e747320...

More easily read: 46 6f 75 72 20 50 6f 69 6e 74 73 20...

If you look these (hex codes) up in an ASCII table, you'll see the following:
46=F
6f=o
75=u
72=r
20=space
50=P
6f=o
69=i
6e=n
74=t
73=s
20=space

Note: As you can see, the original file (20150228.txt) doesn't contain a byte order mark.

When I used I used File for Windows on the "converted" (786Restran.txt) file you posted , it showed "UTF-8 Unicode (with BOM) text, with CRLF line terminators". I also used "xxd" (a Cygwin download) which showed the following: efbbbf466f757220506f696e747320...

More easily read: ef bb bf 46 6f 75 72 20 50 6f 69 6e 74 …

cgeier 187 Junior Poster

Please turn "Option Explicit" on in your VS. It's not a good idea to use variables without declaring them.

In VS 2008/2010:
Click "Tools" in menu bar
Select "Options"
Double-click "Projects and Solutions" to expand it
Click "VB Defaults"
Change "Option Explicit" to "On"
Click "OK"

Also, in looking through your code, it appears that some of your code has gotten out of hand. It isn't apparent what the purpose of "RestranInformationManager.txt" and "RestranFileConversion.txt" are, nor did you include them. It seems that perhaps it is providing information that can be extracted by reading directory contents (ie: folder names and/or filenames)--according to some of your other posts.

What are the 20 textboxes and 20 labels for?
Labels:
-lblProp1
-lblProp2
...
-lblProp20

TextBoxes:
-tbxProp1
-tbxProp2
...
-tbxProp20

It looks like you are using 7 buttons--some of which seem might be better as options in a MenuStrip.

Buttons:
-btnEditPropList
-btnLockPropList
-btnClearAllProp
-btnPropEditor
-btnConvertFiles
-btnInfoMgr
-btnExitSub

cgeier 187 Junior Poster