PDA

View Full Version : A bit of help needed to make a simple program


MustangSVT
06-30-08, 11:24 AM
I need to make this program for work. I have Visual Studio 2008 and I can work with C++, C# and Basic.

A bit of background -> just finished 3rd year computer engineering. Mostly worked with command line C++ and Java (and GUI with Java) at school. I know most things (or so I think) about object oriented methodologies and concepts and how I should be using them. I usually get a lot of help from my classmates when doing programming assignments, but I did pretty well on the programming final (which I studied a lot for, since I knew it wouldn't be easy for me).

Anyway, I need to make a simple GUI (windows) that has two text fields. One is user editable and the user puts in like a sequence of numbers (binary sequence I believe), so I guess a string basically. Then there is a dropdown menu that you select the type of conversion you want. The second text field is the result from the input you selected and the type of conversion you want to get. Long story short, user puts in a binary sequence, selects the "protocol" they are using from the dropdown menu, and then the CRC sequence for that protocol is shown in the second textfield depending on your input.

There's a couple algorithms for how to get the CRC sequence from the "message", and I can get these from my co-workers. I need to make the GUI interface for this basically and implement these algorithms for the respective option you choose from dropdown menu.

I don't want someone to do the code or anything like that for me, I just want to be pointed in the direction I should be going (hopefully a website that really helps with this, some sample of code from a similar type program or sample of code from a simple GUI interface, something like that).

Thank you for any help.

EDIT: Just realized the program I want to make is basically like those HEX/Binary Converter programs, where you have a text field to put in your message, and a bunch of options to select (Binary To Hex, Hex to Binary, Octal, Decimal, etc.), except I'm using a different algorithm to get the "result".

ViN86
06-30-08, 04:02 PM
youll probably hate me for saying this, but i would do it in C#. visual studio would make it much easier, but it can be done in a single text file without it.

all you need is a static drop list with all options, then an event to update a disabled text field (or a label) whenever the user input textbox is changed. the output will be dependent on what the droplist says via simple if statements. there's many built-in functions in the .NET framework that can be used to convert between formats.

that would require the .NET framework. this would take about 10 minutes lol.

MustangSVT
06-30-08, 04:17 PM
youll probably hate me for saying this, but i would do it in C#. visual studio would make it much easier, but it can be done in a single text file without it.

all you need is a static drop list with all options, then an event to update a disabled text field (or a label) whenever the user input textbox is changed. the output will be dependent on what the droplist says via simple if statements. there's many built-in functions in the .NET framework that can be used to convert between formats.

that would require the .NET framework. this would take about 10 minutes lol.

Problem here is I've only coded command line C++ and GUI Java so using Visual Studio and modern C++/.NET is not exactly second nature to me. :o

jcrox
06-30-08, 09:27 PM
Not knowing your level of knowledge in regards to Visual Studio I'll try and explain it as simply as possible..... I'm not trying to insult you, I just don't want to assume you know something so bear with me.

Start Visual Studio
File -> New Project

In the next screen enter your project's name in the text box on the bottom, select Windows Application and click next.

From the toolbox drag and drop 2 text boxes and a combo-box into the GUI

Click on the combo-box and then in the properties window(usually on the bottom right) enter a "name" property for the combo-box (cmbChoices). Repeat with each text box (txtStart, txtFinish). Set the Read Only property of txtFinish to true.

Select the combo-box again and in the properties window enter the values you want in the drop down list in the "Items" property (should say "Collection") next to it.

Double click on the combo-box, this will take you to the code behind screen and create an event handler for the combo-box.

Event Handler:

Private Sub cmbChoice_SelectedIndexChanged(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles cmbChoice.SelectedIndexChanged

insert your code here

End Sub

You can use if....then statements, case statements.... what ever your heart desires here. For example if I was doing temperature conversion using VB.NET


Dim choice as String = cmbChoice.SelectedItem.ToString()
Dim temp as double = CType(txtStart.text, double)
Dim result as double
if choice = "Celcius" then
result = insert f to c equation here
txtFinish.text = result
else
result = insert c to f equation here
txtFinish.text = result
end if


does that help at all?

MustangSVT
07-02-08, 11:48 AM
Yes this helps a LOT actually. I was worried about making code in such a way that the 2nd text box is read only and how to make the dropdown menu properly (i.e. click outside of the dropdown menu to close it), but this really helps a lot. Now I just need to put some titles, get the right algorithm for the operation I do on the input from my co-workers and that'll be it.

ViN86
07-02-08, 03:08 PM
Yes this helps a LOT actually. I was worried about making code in such a way that the 2nd text box is read only and how to make the dropdown menu properly (i.e. click outside of the dropdown menu to close it), but this really helps a lot. Now I just need to put some titles, get the right algorithm for the operation I do on the input from my co-workers and that'll be it.

you can change the text in boxes from anywhere in the code. maybe you were thinking of C++ where you have private variables that you cannot change from other sections of code without a global variable?

you can also add events. so you can add an event that updates the output box when the dropdown menu is changed, or when the input value is changed, as jcrox demonstrated so perfectly. :)

MustangSVT
07-02-08, 03:44 PM
you can change the text in boxes from anywhere in the code. maybe you were thinking of C++ where you have private variables that you cannot change from other sections of code without a global variable?

you can also add events. so you can add an event that updates the output box when the dropdown menu is changed, or when the input value is changed, as jcrox demonstrated so perfectly. :)

Yup I added event when mouse clicks outside of the input button, I also check that the dropdown selection is not empty when updating and I made an "Update" button in case of any weird scenario where the output might not be changed after editing the input field.

Now I'm at the actual hard part. The algorithm to get the CRC code appears is a lot harder than I first thought. It'll take me some time to get this working properly. I need to parse some hex strings (bytes) with spaces in between them and then examine them in a weird fashion. :o

MustangSVT
07-08-08, 01:16 PM
Ok guys well I finished the program. It works very well. Thank you everyone for your help.

ViN86
07-09-08, 09:39 AM
Ok guys well I finished the program. It works very well. Thank you everyone for your help.

glad to hear you got it workin :D

MustangSVT
07-21-08, 12:00 PM
I have a new task I might be working on now. I need to make an installer for an application. You know, something that will enter in data into registry and put it in start menu and all that.

So far I've figured out that NSIS (NullSoft InstallShield) i think, a program made by people who made WinAmp is the way to go. What do you guys think?

ViN86
07-21-08, 12:06 PM
I have a new task I might be working on now. I need to make an installer for an application. You know, something that will enter in data into registry and put it in start menu and all that.

So far I've figured out that NSIS (NullSoft InstallShield) i think, a program made by people who made WinAmp is the way to go. What do you guys think?

you could create your own MSI (windows installer) file.

http://searchwincomputing.techtarget.com/tip/0,289483,sid68_gci1175396,00.html

seems like that would be the ideal way for installing the program in windows.