• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

I hate programming

eshtog

Diamond Member
Jun 7, 2001
3,449
0
0
well I have a assignment one part of the assignment is a user inouts a word, then types in what letter he wants to find in another text box and I am supposed to have a msg box pop up telling him in what position that letter is in, this what I have programmed so far

thanks and I know I suck

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
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.
Friend WithEvents txtEntNum As System.Windows.Forms.TextBox
Friend WithEvents txtSeaLet As System.Windows.Forms.TextBox
Friend WithEvents btnSum As System.Windows.Forms.Button
Friend WithEvents btnFind As System.Windows.Forms.Button
Friend WithEvents txtTexSer As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.txtEntNum = New System.Windows.Forms.TextBox
Me.txtTexSer = New System.Windows.Forms.TextBox
Me.txtSeaLet = New System.Windows.Forms.TextBox
Me.btnSum = New System.Windows.Forms.Button
Me.btnFind = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'txtEntNum
'
Me.txtEntNum.Location = New System.Drawing.Point(32, 32)
Me.txtEntNum.Name = "txtEntNum"
Me.txtEntNum.Size = New System.Drawing.Size(256, 20)
Me.txtEntNum.TabIndex = 0
Me.txtEntNum.Text = "Enter Number"
'
'txtTexSer
'
Me.txtTexSer.Location = New System.Drawing.Point(32, 80)
Me.txtTexSer.Name = "txtTexSer"
Me.txtTexSer.Size = New System.Drawing.Size(256, 20)
Me.txtTexSer.TabIndex = 1
Me.txtTexSer.Text = "Enter Text to be Searched"
'
'txtSeaLet
'
Me.txtSeaLet.Location = New System.Drawing.Point(32, 120)
Me.txtSeaLet.Name = "txtSeaLet"
Me.txtSeaLet.Size = New System.Drawing.Size(144, 20)
Me.txtSeaLet.TabIndex = 2
Me.txtSeaLet.Text = "Enter Search Letter"
'
'btnSum
'
Me.btnSum.Location = New System.Drawing.Point(320, 32)
Me.btnSum.Name = "btnSum"
Me.btnSum.Size = New System.Drawing.Size(80, 24)
Me.btnSum.TabIndex = 3
Me.btnSum.Text = "Sum"
'
'btnFind
'
Me.btnFind.Location = New System.Drawing.Point(320, 80)
Me.btnFind.Name = "btnFind"
Me.btnFind.Size = New System.Drawing.Size(80, 24)
Me.btnFind.TabIndex = 4
Me.btnFind.Text = "Find"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(440, 182)
Me.Controls.Add(Me.btnFind)
Me.Controls.Add(Me.btnSum)
Me.Controls.Add(Me.txtSeaLet)
Me.Controls.Add(Me.txtTexSer)
Me.Controls.Add(Me.txtEntNum)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub txtEntNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEntNum.TextChanged

End Sub

Private Sub txtTexser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTexSer.TextChanged
Dim txtEntNum As Integer
End Sub

Private Sub txtSeaLet_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSeaLet.TextChanged
Dim txtEntNum As String
End Sub

Private Sub btnSum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSum.Click
MsgBox("Sum Of Numbers: " &amp; txtEntNum.Text * (txtEntNum.Text + 1) / 2)
End Sub

Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
Dim txtTexSer As string
Dim txtSeaLet As String




End Sub
End Class
 

DT4K

Diamond Member
Jan 21, 2002
6,944
3
81
It should be a crime to teach programming to business majors.

By the way, the solution to your problem is a single line of code using a built in function that VB.Net provides for you. But if you are too damn lazy to do it yourself, you'll probably find someone willing to do it for you in the correct forum area.
 

maziwanka

Lifer
Jul 4, 2000
10,415
1
0
how can someone b!tch about this assignment? it has to be one of the simplest things i've seen
 

PoPPeR

Diamond Member
Oct 9, 2002
6,993
0
0
You know what sucks. 99% of the universities I'm trying to transfer to want regular intro to computer information systems. So I'm taking that. Then out of the blue, Arizona State tells me that yes, their business majors need to take that too... unless you're an accounting major. Then you have to take visual basic. So now I get to take that next semester too. Fortunately I already have experience with it, but I don't see how its supposed to help me in accounting more than regular comp info systems would.
 

AmigaMan

Diamond Member
Oct 12, 1999
3,644
1
0
You guys are missing the point. This actually training for real-world situations. You see, when they graduate, the people with MBA's just pawn off work to other people and take credit for it. Just like in college they'll just find some compsci geek to do their work for them and take credit for it in the end. They're just talking heads that like to look pretty in meetings.
 

ggnl

Diamond Member
Jul 2, 2004
5,095
1
0
Originally posted by: AmigaMan
You guys are missing the point. This actually training for real-world situations. You see, when they graduate, the people with MBA's just pawn off work to other people and take credit for it. Just like in college they'll just find some compsci geek to do their work for them and take credit for it in the end. They're just talking heads that like to look pretty in meetings.
Sounds like someone's bitter... :disgust:
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Uhh, what exactly did you "program there"? It's the code generated from dropping a few controls on a form in Visual Studio .NET. I see one line of executable code that's yours, and you're already saying you can't hack it?
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: AmigaMan
You guys are missing the point. This actually training for real-world situations. You see, when they graduate, the people with MBA's just pawn off work to other people and take credit for it. Just like in college they'll just find some compsci geek to do their work for them and take credit for it in the end. They're just talking heads that like to look pretty in meetings.

If you don't step up and take credit for something, then someone else will. That's just the way life is. If you want something, then you have to step up and get it. You can't always expect others to make sure credit is properly divided. It might be unfortunate, but it's a reality.

Don't be so passive and you won't have these "talking heads" taking advantage.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Many business jobs will require interfacing/presenting data.

Helps to know the tools that you may be using.
 

DT4K

Diamond Member
Jan 21, 2002
6,944
3
81
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.
 

DT4K

Diamond Member
Jan 21, 2002
6,944
3
81
Originally posted by: PoPPeR
You know what sucks. 99% of the universities I'm trying to transfer to want regular intro to computer information systems. So I'm taking that. Then out of the blue, Arizona State tells me that yes, their business majors need to take that too... unless you're an accounting major. Then you have to take visual basic. So now I get to take that next semester too. Fortunately I already have experience with it, but I don't see how its supposed to help me in accounting more than regular comp info systems would.

As an accountant, you might have some really good reasons to write VBA code for Excel.
 

purbeast0

No Lifer
Sep 13, 2001
53,643
6,527
126
Originally posted by: DT4K
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.

it says nothign about a windows form. it could be a cmd prompt window type display for all i know.

and if thats the case, it is declaring 1 variable, getting 2 inputs, and displaying the result.

int main(){
char word[30], letter;
cin >> word >> letter;
cout << "The letter you chose is the number ";
for (int a = 0; a < size(word), a++){ if (word[a] == letter){ cout << word[a] << " letter\n"; a = size(word); } }
return 0; }

sorry ... 6 lines of code :p, not counting the error checking if the letter does not exist at all, or if it exists a few times, or any of the other things he didnt give specifications on.
 

DT4K

Diamond Member
Jan 21, 2002
6,944
3
81
Originally posted by: purbeast0
Originally posted by: DT4K
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.

it says nothign about a windows form. it could be a cmd prompt window type display for all i know.

and if thats the case, it is declaring 1 variable, getting 2 inputs, and displaying the result.

int main(){
char word[30], letter;
cin >> word >> letter;
cout << "The letter you chose is the number ";
for (int a = 0; a < size(word), a++){ if (word[a] == letter){ cout << word[a] << " letter\n"; a = size(word); } }
return 0; }

sorry ... 6 lines of code :p, not counting the error checking if the letter does not exist at all, or if it exists a few times, or any of the other things he didnt give specifications on.

It says text box.
And like I said, all that code is generated for you automatically.
As far as actually writing code, you should be able to do it in vb.Net with ONE line of code.
 

purbeast0

No Lifer
Sep 13, 2001
53,643
6,527
126
Originally posted by: DT4K
Originally posted by: purbeast0
Originally posted by: DT4K
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.

it says nothign about a windows form. it could be a cmd prompt window type display for all i know.

and if thats the case, it is declaring 1 variable, getting 2 inputs, and displaying the result.

int main(){
char word[30], letter;
cin >> word >> letter;
cout << "The letter you chose is the number ";
for (int a = 0; a < size(word), a++){ if (word[a] == letter){ cout << word[a] << " letter\n"; a = size(word); } }
return 0; }

sorry ... 6 lines of code :p, not counting the error checking if the letter does not exist at all, or if it exists a few times, or any of the other things he didnt give specifications on.

It says text box.
And like I said, all that code is generated for you automatically.
As far as actually writing code, you should be able to do it in vb.Net with ONE line of code.

ah okay, didnt see the text box thing until i read it a third time. and i haven't done VB before so i wouldn't know.
 

Ranger X

Lifer
Mar 18, 2000
11,218
1
0
Business majors are expected to know at least VB for business applications. Just be glad you're not learning a real programming language. :p
 

AmigaMan

Diamond Member
Oct 12, 1999
3,644
1
0
Originally posted by: ggnl
Originally posted by: AmigaMan
You guys are missing the point. This actually training for real-world situations. You see, when they graduate, the people with MBA's just pawn off work to other people and take credit for it. Just like in college they'll just find some compsci geek to do their work for them and take credit for it in the end. They're just talking heads that like to look pretty in meetings.
Sounds like someone's bitter... :disgust:

Not bitter, but that's just the way it usually works. I'm fine with it. As I like to quote, "speak softly, yet carry a big stick", or something like that. anyways, people around me know that when I speak, it's usually for a good reason.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: purbeast0
Originally posted by: DT4K
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.

it says nothign about a windows form. it could be a cmd prompt window type display for all i know.

No offense intended, but if you don't know then you don't know .NET. It's so obviously a Windows Form that any question automatically indicates an almost complete lack of knowledge on the subject.

 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: purbeast0
Originally posted by: DT4K
Originally posted by: purbeast0
Originally posted by: DT4K
Originally posted by: purbeast0
lol that is like 5 lines of code in c++, and he has like 5 pages of code.

You are going to have a windows form with buttons and text boxes in C++ with 5 lines of code?
:roll: I don't think so.
If you do, the rest of the code is just hidden.

As Descartes already said, all that code is generated automatically when you open a windows form project, and drag a button and text boxes on to the form. It's actually very cool that you can see all that code. Much better than VB6 where it's just hidden from you.

it says nothign about a windows form. it could be a cmd prompt window type display for all i know.

and if thats the case, it is declaring 1 variable, getting 2 inputs, and displaying the result.

int main(){
char word[30], letter;
cin >> word >> letter;
cout << "The letter you chose is the number ";
for (int a = 0; a < size(word), a++){ if (word[a] == letter){ cout << word[a] << " letter\n"; a = size(word); } }
return 0; }

sorry ... 6 lines of code :p, not counting the error checking if the letter does not exist at all, or if it exists a few times, or any of the other things he didnt give specifications on.

It says text box.
And like I said, all that code is generated for you automatically.
As far as actually writing code, you should be able to do it in vb.Net with ONE line of code.

ah okay, didnt see the text box thing until i read it a third time. and i haven't done VB before so i wouldn't know.

You don't have to know VB; however, you do have to know .NET. The calls are the same as in any .NET language, the classes are the same, it inherits from System.Windows.Forms.Form, etc.

:beer:
 

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
Originally posted by: AmigaMan
You guys are missing the point. This actually training for real-world situations. You see, when they graduate, the people with MBA's just pawn off work to other people and take credit for it. Just like in college they'll just find some compsci geek to do their work for them and take credit for it in the end. They're just talking heads that like to look pretty in meetings.
No need to put them down... as programmers... once a grunt, always a grunt...