|
I dunno about addressof , but I'd just create two variables, whatever the types, at the top. Then in my switch statements, I would assign them. I'd do the delegate stuff at the bottom, using the variables.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Does the sender object not pass through? It seems to me you should be able to ID the sender inside the delegate and work from that side of the problem. Use one delegate for all of the inputs, that delegate checks the sender ID and matches it to a function based on it's MapTo setting. I forget if you can create a collection of functions in VB.Net, but even without it, that should at least cut the list down to one look up for the MapTo and a 25 option select statement.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
I am having some problems with the code I am writing.. here is the error message I'm getting:
error C2664: 'getFirst' : cannot convert parameter 1 from 'char (*)[100]' to 'char *'
And here is the code that is involved..
#include <iostream>
#include <cstdlib>
using namespace std;
bool getFirst(char *);
bool getLast(char *);
void main()
{
char firstName[100];
char lastName[100];
bool validFName;
bool validLName;
int first;
int last;
int length;
do
{
cout << "Enter your first name in lowercase letters: ";
validFName = getFirst(&firstName);
if (!validFName) cout << "Invalid entry. Try again...\n";
} while (!validFName);
cout << "\n";
do
{
cout << "Enter your last name in lowercase letters: ";
validLName = getLast(&lastName);
if (!validLName) cout << "Invalid entry. Try again...\n";
} while (!validLName);
cout << "\nYour full name is " << firstName << " " << lastName << "\n";
first = strlen(firstName);
last = strlen(lastName);
length = (first + last);
cout << "\nYour full name has " << length << " characters\n";
}
bool getFirst(char *first)
{
int iF,lenF;
char bufFirst[100];
bool validFirst = true;
cin.getline(bufFirst,100);
lenF = strlen(bufFirst);
iF = 0;
while (validFirst && iF < lenF)
{
if ((bufFirst[iF] < 'a') || (bufFirst[iF] > 'z'))
validFirst = false;
iF++;
}
return validFirst;
}
bool getLast(char *last)
{
int iL,lenL;
char bufLast[100];
bool validLast = true;
cin.getline(bufLast,100);
lenL = strlen(bufLast);
iL = 0;
while (validLast && iL < lenL)
{
if ((bufLast[iL] < 'a') || (bufLast[iL] > 'z'))
validLast = false;
iL++;
}
return validLast;
}
I cannot figure out how to get the correct output.. It displays crazy characters and says that my string length is 330 characters long..
Any help with this please??
|
|
|
|
|
Hi,
your subject line is not relevant, the code you have shown is not formatted (use PRE tags, see the CODE BLOCK button), and you are in the wrong forum. Noone will help you here.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Damn, I should have waited to give the moron of the day award...
You're very, very lost. Talk to your teacher, they should know how utterly confused you are, or they can't help you ( or suggest you drop out, one or the other )
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hey, does anyone know where i can get the source codes for vb 2005 case programming assignments..i need the source code for the software package purchase assignment on page 871
|
|
|
|
|
You ask that like we all have the same book you do. Extrememly unlikely. Also, this sounds like it's a textbook you find in class, in which case, you're not getting the code from anyone but yourself. We don't do your homework for you. Never have - never will.
|
|
|
|
|
You left out that it's urgent. You might want to consider doing your own homework.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
the source code is on page 872
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Unfortunately it got printed upside down. Do you have an upright copy?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: Unfortunately it got printed upside down. Do you have an upright copy?
mine too. I turned the keyboard upside down and typed it all, now the text appears upside in my program
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
pɐq ooʇ sı ʇɐɥʇ
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
¿ɯɐɹƃoɹd ʎɯ xıɟ ı op ʍoɥ
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
sǝɔɹnos llɐ ǝʇǝlǝp
pɹɐoqʎǝʞ ɹnoʎ uɹnʇ
upright again, re-enter and rebuild.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I was just wondering because I cant get it to work and im having trouble with it..i just wanted to compare what i had with the right source code so i can see what i did wrong..and yes it is a text book vb 2005 shelly cashman hoisington edition
|
|
|
|
|
In order to analyze what is wrong, you should investigate the behavior, look for symptoms, find the place where it starts to go wrong. That's called debugging, it is an intrinsic part of software development, you need to learn that.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
well, if you already have source code written and need help, feel free to post the relevant code and tell us what what is wrong with it.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Public Class frmSoftwarePackages
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim TotalCost As Decimal
Dim Price As Decimal
Dim Package As String
totalcost = Package * Price
Dim objStudent As Student
objStudent = Student
Dim ObjCustomer As Customer
ObjCustomer = Customer
Dim InputError As Boolean
If Me.txtCreditCard.MaxLength = False Then
MessageBox.Show("Enter your credit card number in the correct location")
Me.txtCreditCard.Clear()
Me.txtCreditCard.Focus()
InputError = True
ElseIf Me.txtCreditCard.TextLength < 16 Or _
Me.txtCreditCard.TextLength > 16 Then
MessageBox.Show("You Entered wrong amount of numbers in credit card box")
Me.txtCreditCard.Clear()
Me.txtCreditCard.Focus()
InputError = True
ElseIf Not IsNumeric(Me.txtCreditCard.Text) Then
MessageBox.Show("Enter Numbers Only")
Me.txtCreditCard.Clear()
Me.txtCreditCard.Focus()
ElseIf Me.cboPackage.SelectedIndex < 0 Then
MessageBox.Show("Please Select a Package")
Me.cboPackage.Focus()
InputError = True
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If Me.RadioButton1.Checked Then
End If
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Me.txtCreditCard.Clear()
Me.txtExp.Clear()
Me.cboPackage.SelectedIndex = -1
Me.RadioButton1.Checked = True
End Sub
Private Sub frmSoftwarePackages_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
here is the other classes
Option Strict On
Public Class Customer
'Inherits Student Class
Inherits Student
'Class Variables
Private _SpeedUpInternet As Boolean
Private _AwritersWrite As Boolean
Private _DistancePersonnel As Boolean
Private _EmailPhoto As Boolean
Private _KeyboardLearner As Boolean
Dim objCustomer As Customer
Sub New(ByVal CreditCard As String, ByVal ExpDate As String, ByVal DecCost As Decimal, _
ByVal Discount As Decimal, ByVal Package As String, ByVal SpeedUpInternet As Boolean, ByVal AwritersWrite As Boolean, _
ByVal DistancePersonnel As Boolean, ByVal EmailPhoto As Boolean, ByVal KeyBoardLearner As Boolean)
MyBase.New(CreditCard, ExpDate, Package, DecCost, Discount)
_SpeedUpInternet = SpeedUpInternet
_AwritersWrite = AwritersWrite
_DistancePersonnel = DistancePersonnel
_EmailPhoto = EmailPhoto
_KeyboardLearner = KeyBoardLearner
End Sub
Public Class Student
'Class variables
Protected _StrCreditCard As String
Protected _StrExpDate As String
Protected _StrPackage As String
Protected _DecCost As Decimal
Protected _Discount As Decimal
Dim objStudent As Student
Sub New(ByVal StrCreditCard As String, ByVal StrExpDate As String, ByVal StrPackage As String, _
ByVal DecCost As Decimal, ByVal Discount As Decimal)
' Assigns arguments to class variables
_StrCreditCard = StrCreditCard
_StrExpDate = StrExpDate
_StrPackage = StrPackage
_DecCost = DecCost
_Discount = Discount
End Sub
Overridable Function ComputeTotal() As Decimal
'Calculate Cost
_DecCost = _StrPackage * _Discount
End Function
Dim decCost As Decimal
Const cdecSpeedUpInternet As Decimal = CDec(334.95)
Const cdecAwritersWriter As Decimal = CDec(578.9)
Const cdecDistancePersonnel As Decimal = CDec(872.45)
Const cdecEmailPhotoManager As Decimal = CDec(129.95)
Const cdecKeyboardLearner As Decimal = CDec(79.95)
End Class
I have no idea what im doing as u can tell
|
|
|
|
|
twiztid_sickz wrote: I have no idea what im doing as u can tell
So do I.
You need to tell us what is wrong first. How do I know what is the problem?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
#(&!@!(*&@#!!!!!!!!!!! MY EYES ARE BLEEDING..................MAKE THE PAIN STOP.
Next time could use any less formatting to make your post more difficult to read?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Congratulations, you win the moron of the day award.
1 - we don't know what book you're using
2 - if we gave you source code, it wouldn't help you pass your course, it would help you fail
3 - you should talk to your teacher if you're stuck
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I use this code for get processor ID
Private Sub GetCpuID()
Dim strComputer
Dim WMI
Dim wmiWin32Object
Dim wmiWin32Objects
Dim strText
strComputer = ""
WMI = GetObject("WinMgmts://" & strComputer)
wmiWin32Objects = WMI.InstancesOf("Win32_Processor")
For Each wmiWin32Object In wmiWin32Objects
strText = "ProcessorID: " & wmiWin32Object.ProcessorId & vbCrLf
Next
MsgBox(strText)
End Sub
but this not work in my program when I log as Guest. Why not work?
modified on Tuesday, April 7, 2009 3:33 PM
|
|
|
|
|
Privacy
I are troll
|
|
|
|
|
What privacy. Can work this when I log as guest or not
|
|
|
|
|
A guest usually can't "snoop" in the system. Just as a guest in your house shouldn't be looking in the cabinets, so is the security of your Windows'. It assumes that guests behave as such and that they are less privileged than full-blown users.
I are troll
|
|
|
|