Nevermind guys!
I'm stupid! I got it.
thanks
Nevermind guys!
I'm stupid! I got it.
thanks
Hello All,
I've been working in a flash site for a couple days and i've gotten a couple errors as of late. Here are the errors:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DefaultAEG_fla::MainTimeline/frame122()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DefaultAEG_fla::MainTimeline/frame48()
at flash.display::MovieClip/gotoAndPlay()
at DefaultAEG_fla::MainTimeline/gotoAbtUs()
Now, I'm hoping a couple of you guys/gals have ran into this before... i've check over and over on my code but can't see what's up.
Line 48 Code:
stop();
/* Button Controls */
/*Home Button*/ Home.addEventListener(MouseEvent.CLICK, gotoHome);
/*About Us Button*/ AbtUs.addEventListener(MouseEvent.CLICK, gotoAbtUs);
/*Events Button*/ Evnts.addEventListener(MouseEvent.CLICK, gotoEvnts);
/*Coding for Blocks on left*/
abtBlck.addEventListener(MouseEvent.CLICK, gotoabtBlck);
BioBlck.addEventListener(MouseEvent.CLICK, gotoBioBlck);
CntctBlck.addEventListener(MouseEvent.CLICK, gotoCntctBlck);
Line 122 Code:
stop();
/*Home Button*/ Home.addEventListener(MouseEvent.CLICK, gotoHome);
/*About Us Button*/ AbtUs.addEventListener(MouseEvent.CLICK, gotoAbtUs);
/*Events Button*/ Evnts.addEventListener(MouseEvent.CLICK, gotoEvnts);
any ideas on where i'm going wrong?
and here's all of the code on the site
/* Button Methods */
/*This is the function Method for the Home button, it returns the user home to the 1st Frame*/
function gotoHome(event:MouseEvent):void
{
gotoAndPlay(1);
}
/*This is the function Method for the about button, it goes to the AEG anime and then to the abtPage*/
function gotoAbtUs(event:MouseEvent):void
{
gotoAndPlay(18);
}
/*This is the function Method for the events button, it goes to the AEG anime and then to the EvntsPage*/
function gotoEvnts(event:MouseEvent):void
{
gotoAndPlay(87);
}
/*About Page Button …
okay, i'm gonna try the second style...
will it work if i wanted more that 1 mouseover spot?
hey guys
i have a image around 995x700. and i'm about to change up a couple things on a site i'm working on and want to add a mouseover event (or something like that) to it.
i certain areas, i would like the user to mouse over and see a new image rise up in front of the existing image, and then go away when they "mouse off" (i guess that's the term).
i know there is a possible way through jscript or ajax.
please help AND teach me, i really wanna LEARN how to make this work.
any suggestions?
OKAY GUYS
i did some reading and got some help and listened to ya'll and finally got this done.
the below code is what worked for me. i hope it helps anyone who may be in my same position.
Private Sub AddClass2db() 'this block below is to add the record straight into the
'database when the user inserts the validated info
'sql Connection Variables
Dim myConnection As SqlConnection
Dim strInsert As String = ""
'Sql Commands
Dim myCommand As SqlCommand
'no password needed, using MS Auth
myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Ein05\Documents\Visual Studio 2008\Projects\GradeListApplication2Update\GradeListApplication2\dbGradeListApplication.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
myConnection.Open()
'the below order must be maintained to tell the program:
'1) what the strInsert will insert
'2) then turn the strInsert into a Command
'3) Execute the Command
strInsert = "Insert Into tblClasses (ClassId, ClassName, Department) VALUES ( " & CInt(nudClassId.Value) & ", '" & txtClassName.Text.Trim & "', '" & txtDepartment.Text & "')"
myCommand = New SqlCommand(strInsert, myConnection)
myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted")
myConnection.Close()
End Sub
okay adatapost,
i chose option #2 that you showed me.
this is what i have now... VS isn't fussing with the coding anymore but it isn't sending records to the db.
am i placing and/or implementing your code correctly?
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class frmClassAdd
Dim m_intClassId As Integer = 0
#Region " Form Controls & Events "
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If ValidateData() <> True Then Exit Sub
Call AddClass2db()
Call AddClassRecord()
Me.Close()
End Sub
#End Region 'Form Controls & Events
'Contains submit and cancel buttons
#Region " Form Subs & Functions "
Private Sub AddClassRecord()
Dim row As DataRow = Nothing
row = g_dsGradeList.Classes.NewRow
row("ClassId") = nudClassId.Value
row("ClassName") = txtClassName.Text.Trim
row("Department") = txtDepartment.Text.Trim
g_dsGradeList.Classes.Rows.Add(row)
End Sub
Private Sub AddClass2db()
'this block below is to add the record straight into the database when
'the user inserts the validated info
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
' Dim ClassId As String
'Dim ClassName As String
'Dim Department As String
'you need to provide password for sql server
myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Ein05\Documents\dbGradeListApplication.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
myCommand = New SqlCommand("INSERT INTO tblClasses (ClassId,ClassName,Department) VALUES (@ClassId,@ClassName,@Department)")
myCommand.Connection = myConnection
myCommand.Parameters.Add(New SqlParameter("@ClassId", SqlDbType.NChar, 10)).Value = nudClassId.Value
myCommand.Parameters.Add(New SqlParameter("@ClassName", SqlDbType.NVarChar, 50)).Value = txtClassName.Text
myCommand.Parameters.Add(New SqlParameter("@Department", SqlDbType.NVarChar, 50)).Value = txtDepartment.Text
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
with these queries... am i replacing my "myCommand" line, or am i removing my "myCommand" line and placing this code you showed me somewhere else?
Two ways to go:
1. Form a query,
myCommand = new SqlCommand("INSERT INTO tblClasses (ClassId,ClassName,Department) VALUES "('" & nudClassId.Value & "','" & txtClassName.Text & "','" & txtDepartment.Text & "')") myCommand.Connection=myConnection myConnection.Open() myCommand.ExecuteNonQuery() myConnection.Close() 'Note: 'Wrap non-numeric (string or date) fields using single quote.
2. Use Parameterized query (Recommend method),
myCommand = new SqlCommand("INSERT INTO tblClasses (ClassId,ClassName,Department) VALUES (@classid,@classname,@department)") myCommand.Connection=myConnection myCommand.Parameters.Add(new SqlParameter("@classid",SqlDbType.VarChar,20)).Value= nudClassId.value myCommand.Parameters.Add(new SqlParameter("@classname",SqlDbType.VarChar,30)).Value= txtClassName.Text myCommand.Parameters.Add(new SqlParameter("@department",SqlDbType.VarChar,20)).Value= txtDepartment.Text myConnection.Open() myCommand.ExecuteNonQuery() myConnection.Close()
hey all,
I'm using a form to throw info straight into a database. i know it isn't the best way but i'm new and all other implementations have confused me (i've been reading and watching tutorials for 2 weeks) but anyway i'm going to take the info straight from the form.
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class frmClassAdd
Dim m_intClassId As Integer = 0
#Region " Form Controls & Events "
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If ValidateData() <> True Then Exit Sub
Call AddClassRecord()
Call AddClass2db()
Me.Close()
End Sub
#End Region 'Form Controls & Events
'Contains submit and cancel buttons
#Region " Form Subs & Functions "
Private Sub AddClassRecord()
Dim row As DataRow = Nothing
row = g_dsGradeList.Classes.NewRow
row("ClassId") = nudClassId.Value
row("ClassName") = txtClassName.Text.Trim
row("Department") = txtDepartment.Text.Trim
g_dsGradeList.Classes.Rows.Add(row)
End Sub
Private Sub AddClass2db()
'this block below is to add the record straight into the database when
'the user inserts the validated info
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim ra As Integer 'integer holds the number of records inserted
Dim ClassId As String
Dim ClassName As String
Dim Department As String
'you need to provide password for sql server
myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Ein05\Documents\dbGradeListApplication.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
myConnection.Open()
myCommand = new SqlCommand INSERT INTO tblClasses (ClassId,ClassName,Department)VALUES "('" + nudClassId.Value + "," +txtClassName.Text + "," + txtDepartment.Text "')";
ra = myCommand.ExecuteNonQuery() …
okay, just sent you a pm
okay, sounds cool.
what i'm working with now is
<Serializable()> _
Public Class Course
Implements System.ComponentModel.INotifyPropertyChanged
Private mStringRep As String = String.Empty
Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Private mClassID As String = String.Empty
Public Property mClassID() As String
Get
Return mClassID
End Get
Set(ByVal value As String)
If Not mClassID = value Then
mClassID = value
OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("ClassID"))
End If
End Set
End Property
Private mExercise As String = String.Empty
Public Property Exercise() As String
Get
Return mExercise
End Get
Set(ByVal value As String)
If Not mExercise = value Then
mExercise = value
OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("Exercise"))
End If
End Set
End Property
Private mGrade As String = String.Empty
Public Property Grade() As String
Get
Return mGrade
End Get
Set(ByVal value As String)
If Not mGrade = value Then
mGrade = value
OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("Grade"))
End If
End Set
End Property
Private mStudentID As String = String.Empty
Public Property StudentID() As String
Get
Return mStudentID
End Get
Set(ByVal value As String)
If Not mStudentID = value Then
mStudentID = value
OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("StudentID"))
End If
End Set
End Property
Protected Overridable Sub OnPropertyChanged(ByVal e As System.ComponentModel.PropertyChangedEventArgs)
GenerateStringRep()
RaiseEvent PropertyChanged(Me, e)
End Sub
Private Sub GenerateStringRep()
Dim sb As New System.Text.StringBuilder
If mClassID.Length > 0 Then
sb.AppendLine("Course Name: " & mClassID)
End If
If mStudentID.Length > 0 Then
sb.AppendLine("Student ID: " & mStudentID)
End If
If mExercise.Length > 0 Then
sb.AppendLine("Exercise: " & mExercise)
End If
If mGrade.Length > 0 Then
sb.AppendLine("Grade: " & mGrade)
End …
hey all,
i'm working on a code that i want to start creating new classes with but i want to know if there's a more direct way to send the variables used in the form to a new class for storage.
for example i've got this on a form...
Dim ClassID As String
Dim ClassName As String
Dim Grade As String
Dim Exercise As String
Dim file As String = "C:\Users\Ein05\Documents\Visual Studio 2008\Projects\GradeListApplication\GradeListApplication\Grades.txt"
ClassID = xClassIDTextBox.Text
ClassName = xStudentIDTextBox.Text
Exercise = xExerciseTextBox.Text
Grade = xGradeTextBox.Text
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
My.Computer.FileSystem.WriteAllText(file, "Class ID: ", True)
My.Computer.FileSystem.WriteAllText(file, ClassID, True)
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
My.Computer.FileSystem.WriteAllText(file, " Class Name: ", True)
My.Computer.FileSystem.WriteAllText(file, ClassName, True)
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
My.Computer.FileSystem.WriteAllText(file, " Exercise: ", True)
My.Computer.FileSystem.WriteAllText(file, Exercise, True)
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
My.Computer.FileSystem.WriteAllText(file, " Grade: ", True)
My.Computer.FileSystem.WriteAllText(file, Grade, True)
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
My.Computer.FileSystem.WriteAllText(file, ControlChars.NewLine, True)
xClassIDTextBox.Text = String.Empty
xStudentIDTextBox.Text = String.Empty
xExerciseTextBox.Text = String.Empty
xGradeTextBox.Text = String.Empty
but now i want to create a class called Class (i know... creative right)
but i want to assign all of the variables as like properties and be able to sort of categorize them. so if the user enters more than 1 class the stored info will be like.
class 1: eng 101
class 2: eng 202
you know? so what would be my most direct route to get this?
and i want to UNDERSTAND so please critique me... but TEACH me as well. (for any snark comments out there)
thanx
thanx babbu and geek.
i got that working great.
now, with the new form that loads... how do i edit it? you know, add text boxes, labels buttons, etc.?
any suggestions?
hey all,
I have a form where a user selects from a couple radio buttons. once THAT button is selected i want a new form to load where the user has to fill out personal info and submit.
what's the best and easiest way to set this up?
like:
1) button selected
2) that form disappears
3) new form that requires text info loads
thanx guys for the responses. i guess i'll just keep my eyes open.
thanx
Yeah... the semester is on! lol
but anyway, i'm trying to find a solution manual for my text and wonder where you guys get 'em? i'm a decent googler and haven't came up on anything yet.
my text:
Microsoft Visual Basic 2005 RELOADED: Advanced
by: Richard A. Johnson/Diane Zak
any tips? (didn't know where to post this question... sorry)
hey, i'm going to be working on a site for a small company and they want to use BluHost.
I'm going to be using pretty much just HTML, CSS and JavaScript.
will this be a good set up for me? or will i be better off telling them to find a host somewhere else?
thanx man. will try tonight and tell you in the morning
well he's saying the whole code (as far as the if statements go) should be a loop but i'm not seeing how to change it.
Option Explicit On
Option Strict On
Public Class MainForm
'show the random number
Dim randomGenerator As New Random
Dim randomnum As Integer = randomGenerator.Next(1, 51) 'give the number
Private chancecount As Integer
Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
Dim usernum As Integer
Dim isConverted As Boolean
isConverted = Integer.TryParse(Me.xEnterTextBox.Text, usernum)
If chancecount <= 8 Then
If isConverted = True Then
If chancecount <= 8 AndAlso usernum < randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Oops, too low. Go a little higher"
ElseIf chancecount <= 8 AndAlso usernum > randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Whoa! Whoa! You're guessing a little TOO high now."
ElseIf usernum = randomnum Then
Me.xAnswerLabel.Text = "Congratulations, you have selected the correct number which is, " + Convert.ToString(usernum) + "!"
End If
End If
ElseIf chancecount > 8 Then
Me.xAnswerLabel.Text = "We are so sorry but your chances have expired. Don't fret, try with us again anytime. Just exit this application and restart the program. But remember... The number will never be the same! Happy Hunting!"
End If
End Sub
End Class
that's what i'm thinking but my professor's like... "I want you to use a loop"
and i don't see how to make this work from a loop at all.
hey guys,
i've got an 'if' statement that works but i have to change it into a 'loop' statement. i originally chose 'if' because it's easier for me to understand but... it's gotta be a loop.
so if anyone could, what would be the best loop style and how would i set it up?
If chancecount <= 8 Then
If isConverted = True Then
If chancecount <= 8 AndAlso usernum < randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Oops, too low. Go a little higher"
ElseIf chancecount <= 8 AndAlso usernum > randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Whoa! Whoa! You're guessing a little TOO high now."
ElseIf usernum = randomnum Then
Me.xAnswerLabel.Text = "Congratulations, you have selected the correct number which is, " + Convert.ToString(usernum) + "!"
End If
End If
ElseIf chancecount > 8 Then
Me.xAnswerLabel.Text = "We are so sorry but your chances have expired. Don't fret, try with us again anytime. Just exit this application and restart the program. But remember... The number will never be the same! Happy Hunting!"
End If
got it guys. just decided to use an iframe
thanx a bunch!
the one that says
document.slideshow.src = NewImg[ImgNum];
there is only one
GOT IT! THANX FOR THE SUPER HELP!
where do i place this?
in the #1,#2, and #3 for the jscript?
hey all,
i found a way to click a link and load it into a div. the only problem is that i keep getting the "AHA error" from the if statement in my div.
i'm not sure if it is me or the coding but i'll post what i'm using in jscript here:
function ahah(url, target) {
document.getElementById(target).innerHTML = ' Fetching data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req != undefined) {
req.onreadystatechange = function() {ahahDone(url, target);};
req.open("GET", url, true);
req.send("");
}
}
function ahahDone(url, target) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML = req.responseText;
} else {
document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
}
}
}
function load(name, div) {
ahah(name,div);
return false;
}
and this is what i'm using on the html side
<area shape="rect" coords="255,519,399,558" href="history.html" onclick="load('history.html','leftmain');return false;">
Please let me know where i'm going wrong. i don't think it's because i'm using an image map (i know... ol' skoolin it) but i'm not sure where to go for help.
thanx in advance.
entered the code but it's giving an error when i select any of the links like "next, previous"
when i click: Safari gives and error page and shows nothing
Firefox just throws the first image under the div
IE8 says Internet Explorer cannot display the webpage
is it because i'm using png and not gif?
i put the jscript on another file and am referencing the file correctly but just not getting any love from the function. help?
hey all,
i found a way to click a link and load it into a div. the only problem is that i keep getting the "AHA error" from the if statement in my div.
i'm not sure if it is me or the coding but i'll post what i'm using in jscript here:
function ahah(url, target) {
document.getElementById(target).innerHTML = ' Fetching data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req != undefined) {
req.onreadystatechange = function() {ahahDone(url, target);};
req.open("GET", url, true);
req.send("");
}
}
function ahahDone(url, target) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML = req.responseText;
} else {
document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
}
}
}
function load(name, div) {
ahah(name,div);
return false;
}
and this is what i'm using on the html side
<area shape="rect" coords="255,519,399,558" href="history.html" onclick="load('history.html','leftmain');return false;">
Please let me know where i'm going wrong. i don't think it's because i'm using an image map (i know... ol' skoolin it) but i'm not sure where to go for help.
thanx in advance.
not sure if this has been answered before. i looked through the jscript/dhtml spot and didn't see anything on the boards that looked solved so...
I want to put multiple pictures in a table, then put that table in a div and have an auto timer show them in sequence (or random... doesn't matter).
i figure there's a way to do this but i just can't get my finger on it. any help is mucho appreciated.
oh also, if there's jscript, ajax,css or whatever involved please let me know where to place said code.
thank you,
ps. if you have a link to anywhere that already explains please let me know
thanx for the help 'shadiadiph' and 'ejosiah'... i was about to ask this question today
Thanx a lot! I knew it could be done but I just needed a lil guidance. Really helps!
Peace!
Hey guys.
I have a code that i'm trying to build with 2 nested divs that i want to align beside each other. i'm not sure if the below is the best way to go about it but it's the only way i could think of. only thing is that the div always just ends up under the one above it (in the nest).
So please, any guidance is UBER-appreciated.
Thanx
(i don't mind... let me know what i'm doing wrong.)
<div id="main" style="width: 1265px; height: 560px; overflow: auto;"> <!-- Middle -->
<div id="leftmain" align="left" style="width: 705px; height: 560px; ">
<table>
<tr id="row">
<td>
<img src="church.jpg" /></td>
<td>
<img src="church.jpg" /></td>
<td>
<img src="church.jpg" /></td>
</tr>
</table>
</div>
<div id="rightmain" align="right" style="width: 560px; height: 560px; ">
<table>
<tr id="row">
<td>
1<img src="1.jpg" /></td>
<td>
2<img src="2.jpg" /></td>
<td>
3<img src="3.jpg" /></td>
</tr>
</table>
</div>
<script type="text/javascript">
var td = row.firstChild;
function animate() {
someID.scrollLeft = td.offsetLeft;
if (td == row.lastChild)
td = row.firstChild;
else
td = td.nextSibling;
setTimeout("animate()", 8000);
}
animate();
</script>
</div>
OH MAN! this looks helpful as hell. (if i can say that here...)
BUT THANX!!!
hey all,
i've only been using ajax for about 2 weeks but i was wondering, if at all, can you make an effect similar to the one here:
www.okayplayer.com (this also happens on sites like nba.com, espn.com etc)
on the top of the page with the pictures scrolling with news and links inside of them without using flash. like with ajax or something?
and if it can be done... how would i go about it?
well i changed this:
If textlength2 <= 6 Then
length(2) = "short"
ElseIf textlength2 > 6 And textlength <= 10 Then
length(2) = "standard"
ElseIf textlength2 > 10 Then
length(2) = "long"
End If
to this:
If textlength2 > 10 Then
length(2) = "long"
ElseIf textlength2 <= 6 Then
length(2) = "short"
Else
length(2) = "standard"
End If
and now it works just fine
finally got it!
this works. don't ask me what made this code any better than what was originally down but whatever
textlength = namepart(0).Length
If textlength <= 6 Then
length(0) = "short"
ElseIf textlength > 10 Then
length(0) = "long"
Else
length(0) = "standard"
End If
textlength1 = namepart(1).Length
If textlength1 <= 6 Then
length(1) = "short"
ElseIf textlength1 > 10 Then
length(1) = "long"
Else
length(1) = "standard"
End If
textlength2 = namepart(2).Length
If textlength2 > 10 Then
length(2) = "long"
ElseIf textlength2 <= 6 Then
length(2) = "short"
Else
length(2) = "standard"
End If
i know this seems like the dumbest thing on the planet but this works:
If textlength2 > 10 Then
length(2) = "long"
ElseIf textlength2 > 6 And textlength <= 10 Then
length(2) = "standard"
ElseIf textlength2 <= 6 Then
length(2) = "short"
End If
and this one doesn't
If textlength2 <= 6 Then
length(2) = "short"
ElseIf textlength2 > 6 And textlength <= 10 Then
length(2) = "standard"
ElseIf textlength2 > 10 Then
length(2) = "long"
End If
go figure...and it's only on this structure. the others never had that problem
thanx. now it's weird b/c it won't work if the length is standard. like if the length is standard, nothing shows in the blank i've set for it
great news! i've figured it all down to 1 thing... the last word is not displaying the length correctly... any help, my logic's gotta be wrong at the last piece of the message in the label
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
'go for it!
Dim i As Integer
Dim textlength As Integer
Dim textlength1 As Integer
Dim textlength2 As Integer
Dim wholename As String
Dim namepart(3) As String
Dim length(3) As String
wholename = Me.xEnterTextBox.Text
For i = 0 To Me.xEnterTextBox.Text.Length - 1
namepart = wholename.Split(" ")
Next
textlength = namepart(0).Length
If textlength <= 6 Then
length(0) = "short"
ElseIf textlength > 6 And textlength <= 10 Then
length(0) = "standard"
ElseIf textlength >= 11 Then
length(0) = "long"
End If
textlength1 = namepart(1).Length
If textlength1 <= 6 Then
length(1) = "short"
ElseIf textlength1 > 6 And textlength <= 10 Then
length(1) = "standard"
ElseIf textlength1 >= 11 Then
length(1) = "long"
End If
textlength2 = namepart(2).Length
If textlength2 <= 6 Then
length(2) = "short"
ElseIf textlength2 > 6 And textlength <= 10 Then
length(2) = "standard"
ElseIf textlength2 >= 11 Then
length(2) = "long"
End If
Me.xAnswerLabel.Text = "Your first name is " & namepart(0) & ", it is " & textlength & _
" characters," & " and it is " & length(0) & " length" & ". " & _
"Your middle name is " & namepart(1) & ", it is " & textlength1 & _
" characters," & …
hey guys. i've got this code where i've gotta separate a full name and tell the user which is which (meaning "this name is first, this name is middle, and this is your last name" type stuff). Well i've got the first part working where the program tells you what part of the name you're using but i've also got to tell the user this:
Short length names are defined as 6 or fewer letters.
Standard length names are defined as 7 to 10 letters.
Long length names are defined as having more than 11 letters.
this meaning i've got to say: "your first name is Michael, it has 7 letters, it is standard length. your middle name is john, it has 4 letters, it is short length. your last name is kirkpatrick, it has 11 letters, it is long length."
help? here's the code
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
'go for it!
Dim i As Integer
Dim wholename As String
Dim namepart(3) As String
wholename = Me.xEnterTextBox.Text
For i = 0 To Me.xEnterTextBox.Text.Length - 1
namepart = wholename.Split(" ")
Next
Me.xAnswerLabel.Text = "Your first name is " & namepart(0) & ". " & _
"Your middle name is " & namepart(1) & ". " & "Your last name is " & namepart(2) & ". "
End Sub
Thanx in advance for any help to get me over the hump
hey all. the program is for Chapter 8 Lesson C in the Visual Basic 2005
below is code where i have to create a program that allows the user to enter a 4-digit number that identifies whether the salesperson is full or part time.
"Each salesperson at BobCat Motors is assigned an ID number, which consists of four characters. The first character is either the letter F or the letter P. The letter F indicates that the salesperson is a full-time employee. The letter P indicates that he or she is a part-time employee. The middle two characters are the salesperson's initials, and the last character is either a 1 or a 2. A 1 indicates that the salesperson sells new cars, and a 2 indicates that the salesperson sells used cars.
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
'variables
Dim strInput As String = ""
Dim str1stCharacter As String = ""
Dim strlstCharacter As String
Dim strOutput As String = ""
Dim fullt As Integer = 0
Dim partt As Integer = 0
Dim newsellcar As Integer = 0
Dim usesellcar As Integer = 0
strInput = Me.xIdTextBox.Text
' changes the id number case to upper
strInput = Me.xIdTextBox.Text.ToUpper()
' sets the focus
Me.xIdTextBox.Focus()
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1)
strlstCharacter = Microsoft.VisualBasic.Left(strInput, 4)
If str1stCharacter = "F" And strlstCharacter = "1" Then
'salesperson is fulltime and sells new cars
Me.xFulltimeLabel.Text =
Me.xNewCarsLabel.Text = CStr(newsellcar)
ElseIf str1stCharacter = "F" And strlstCharacter = "2" …
cool, working except with the word "ant" to "ant-way"
okay, i've got the first part working but I've still got problems with the second part outlining words that start with cons.
here's the new code.
Private Sub xTranslateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xTranslateButton.Click
Dim strInput As String
Dim str1stCharacter As String
Dim strOutput As String
Dim intStringLength As Integer
strInput = Me.xEnterText.Text
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1)
If str1stCharacter = "A" Or str1stCharacter = "E" _
Or str1stCharacter = "I" Or str1stCharacter = "O" _
Or str1stCharacter = "U" Or str1stCharacter = "Y" _
Or str1stCharacter = "1" Or "2" Or "3" Or "4" Or "5" Or "6" Or "7" Or "8" Or "9" Or "0" Then
strOutput = strInput & "-WAY"
ElseIf str1stCharacter = "Q" Or "W" Or "R" Or "T" Or "P" Or "S" _
Or "D" Or "F" Or "G" Or "H" Or "J" Or "K" Or "L" Or "Z" _
Or "X" Or "C" Or "V" Or "B" Or "N" Or "M" Then
intStringLength = Len(strInput)
strOutput = Microsoft.VisualBasic.Right(strInput, 3) _
& "-" & Microsoft.VisualBasic.Left(strInput, 2) & "AY"
End If
Me.xAnswerLabel.Text = "The Pig Latin Translation of " & strInput & " is " & strOutput & "."
End Sub
Hey all,
I've got this program where I have to translate a word from English to Pig Latin. I'm sorta on the brink but I'm missing something.
the test words are "ant" and "chair" but they should then turn to "ant-WAY" and "air-chay"
but i'm ending up with "ant-anAY" and "air-ChAY"
and even further I know that I'm kinda cheating on the chair translation because it definitely won't work with any other word that doesn't start with a vowel. Finally is someone enters a numeric value like 56 it should show "56-WAY".
I'm stuck...any help? Code below
Private Sub xTranslateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xTranslateButton.Click
Dim strInput As String
Dim str1stCharacter As String
Dim strOutput As String
Dim intStringLength As Integer
strInput = Me.xEnterText.Text
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1)
If str1stCharacter = "A" Or str1stCharacter = "E" _
Or str1stCharacter = "I" Or str1stCharacter = "O" _
Or str1stCharacter = "U" Or str1stCharacter = "Y" Then
strOutput = strInput & "-WAY"
Else
intStringLength = Len(strInput)
strOutput = Microsoft.VisualBasic.Right(strInput, 3) _
& "-" & Microsoft.VisualBasic.Left(strInput, 2) & "AY"
End If
Me.xAnswerLabel.Text = "The Pig Latin Translation of " & strInput & " is " & strOutput & "."
End Sub
sorry, i had to restart my browser.
all fine now.
noob, i know...whatever.
hey all,
i'm working on this test site to get frames to work. i've got the two frames on the left and middle showing a page but they will only show one page and not another if i make a new one.
here's the code below.
<HTML>
<HEAD><TITLE>TEST</TITLE>
</HEAD>
<FRAMESET BORDER = 5 BORDERCOLOR = brown ROWS="90,*">
<FRAME SRC = "top.html" SCROLLING = NO>
<FRAMESET COLS="170,*">
<FRAME SRC = "live.html" SCROLLING = NO>
<FRAME SRC = "live.html">
</FRAMESET>
</FRAMESET>
</HTML>
and here's the other page for the "top" frame file
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR = "RED"><BR><BR>
</BODY>
</HTML>
the coding is picking up the "live" page but not the "top" page. i'm new (meaning just started yesterday) to HTML...where am i going wrong?
Actually i don't understand your program. please explain more detail what you want to do.
well i'll take the statement straight from the book.
"In this exercise, you create an application that allows the user to enter any number of monthly rainfall amounts. the application should calculate and display the total rainfall amount and the average rainfall amount.
any error occurred?
not really an error but just nothing. the application locks up and then i have to restart it
Hey all, got a syntax and run prob with a program I'm working with that takes in rainfall amounts and then shows the total rainfall amount and then gives an average of. I then end up displaying those figures for the user.
as you can see below in the CalcTotalAndAverage and xCalcButton parts...I'm kinda hitting a wall. and help, hints?
Option Explicit On
Option Strict On
Public Class MainForm
Private Sub CalcTotalAndAverage(ByVal rainCounter As Integer, _
ByVal rainAccum As Decimal, _
ByVal avgRain As Decimal)
rainAccum = rainCounter
avgRain = (rainAccum / rainCounter)
End Sub
Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
' calls a procedure to calculate the total and average
' rainfall amounts, then displays both amounts
Static rainCounter As Integer
Static rainAccum As Decimal
Dim avgRain As Decimal
Call CalcTotalAndAverage(rainCounter, rainAccum, avgRain)
Me.xTotalLabel.Text = rainAccum.ToString("N2")
Me.xAverageLabel.Text = avgRain.ToString("N2")
Me.xMonthlyTextBox.Focus()
Me.xMonthlyTextBox.SelectAll()
End Sub
Private Sub xMonthlyTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles xMonthlyTextBox.Enter
Me.xMonthlyTextBox.SelectAll()
End Sub
Private Sub xMonthlyTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles xMonthlyTextBox.KeyPress
' accept numbers, the period, and the Backspace
If (e.KeyChar < "0" OrElse e.KeyChar > "9") _
AndAlso e.KeyChar <> "." AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Private Sub xMonthlyTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles xMonthlyTextBox.TextChanged
Me.xTotalLabel.Text = String.Empty
Me.xAverageLabel.Text = String.Empty
End Sub
End Class
okay...just solved this myself...
lol, this forum is very therapeutic haha.
Option Explicit On
Option Strict On
Public Class MainForm
'show the random number
Dim randomGenerator As New Random
Dim randomnum As Integer = randomGenerator.Next(1, 51) 'give the number
Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
Dim usernum As Integer
Dim chancecount As Integer = 0
Integer.TryParse(Me.xEnterTextBox.Text, usernum)
If usernum < randomnum AndAlso chancecount <= 10 Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Oops, too low. Go a little higher"
ElseIf usernum > randomnum AndAlso chancecount <= 10 Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Whoa! Whoa! You're guessing a little too high now."
ElseIf usernum = randomnum Then
Me.xAnswerLabel.Text = "Congratulations, you have selected the correct number which is, " + Convert.ToString(usernum) + "!"
End If
End Sub
End Class
okay,
forget the above. I got it working with this except:
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
'show the random number
Dim randomnum As Integer
Dim randomGenerator As New Random
randomnum = randomGenerator.Next(1, 51) 'give the number
Dim usernum As Integer
Dim chancecount As Integer = 0
Integer.TryParse(Me.xEnterTextBox.Text, usernum)
If usernum < randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Oops, too low. Go a little higher"
ElseIf usernum > randomnum Then
chancecount = chancecount + 1
Me.xAnswerLabel.Text = "Whoa! Whoa! You're guessing a little too high now."
ElseIf usernum = randomnum Then
Me.xAnswerLabel.Text = "Congratulations, you have selected the correct number which is, " + Convert.ToString(usernum)
End If
End Sub
the only thing now is that the pc won't keep the number...should i create the random variable when the program loads?