|
This looks worringly similar to a homework posting a few weeks ago...
Here[^]
Why not try calculating it by hand on a bit of paper then work through the code and see why the results don't match, it's very, very obvious.
|
|
|
|
|
This is the exact code someone here on CodeProject wrote for you. Unfortunately for you, he didn't supply you with any documentation, did he? You're going to have to sort through this yourself and doublecheck the math being performed against the rules described in your assignment.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The most amusing part is that a further post actually said that the calculation was wrong!
This homework must be realy late by now.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
|
|
|
|
|
Shay, you didn't state the exact problem you're having? is it not calculating at all? what happens when you single step? I'm sure you walked through this using F11.
One small suggestion. The first assignment statement Salary = lblResult.Text will blow up if there's not a number in there. And you're assuming VB will do a cast from string to int for you. Always better to cInt the conversion, and wrap all the code in a Try..Catch.
good luck,
john
|
|
|
|
|
I want to write a program to control the output of a parallel port (ie operate individual pins) but the current dll I'm using doesn't want to work. I don't know if this is because i'm using xp or if the dll is dodgy. If anyone one knows a way around using dll's or has one that works pls help
|
|
|
|
|
There is absolutely no way of doing this without the help of a .DLL running in Ring 0. You'll have no direct contact with the hardware any other way.
I've been using the library at Logix4U (http://www.logix4u.net/[^]) without any problems for my projects.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks, got the inpout32.dll from logix4u, it looks great.
Now my next prblem along the way, is there a standard for the wiring of a parallel port (ie which colour goes to which port)? I've been looking all over and I'm beginning to think I'm going to have to test each and every wire...
|
|
|
|
|
For the color of the wires? No, there isn't. But the function of each pin on the DB-25 connector is.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
anybody having sample code for sending emails using Extended MAPI objects?? if so pls help me... its urgent... or give any sample code links...
Thanks in advance...
Boomi.
|
|
|
|
|
Extended MAPI is referred to as MAPI 1.0 and is the FULL function library. CDO.DLL (Collaboration Data Objects) wraps a good chunk of the MAPI API, but not all of it. There is a second flavor of CDO called CDONTS. CDONTS is an SMTP implementation, not MAPI, and will render certain message contents as HTML.
Simple MAPI is a subset of 12 functions that implement just the basic functionality of MAPI.
Visual Basic 3 thru 6 and Outlook Express all supply objects that support Simple MAPI only!
In order to use the FULL functionality of the MAPI 1.0 specification, you'll have to P/Invoke the MAPI functions yourself, defining Declares and structures that are required by the MAPI API Library.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Try to check the information from here.[^]
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
How is the Product Version build and revision number value incremented? It doesn't seem to change when every build is done.
Any hints?
|
|
|
|
|
In your project's .config file, there is an AssemblyVersion attribute. If the string in that attribute tab has an asterisk in it, like "1.1.*", it will autoincrement the build and revision parts. By default, the build portion will be the number of days since Jan 1, 2000 and the revision portion will be the number of seconds since midnight divided by 2.
I highly recommend you DON'T use autoincrementing values. If your projects will have any COM interaction, letting the version number change every time you hit "Build" will play hell with applications using your components.
EDIT:
BTW: ProductVersion doesn't increment on it's own. You have to change it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If I want to adjust the height property of RptLine in the data report at run-time, what sholud i do if it's possible?
|
|
|
|
|
I've never used the DataReport objects, but from the documentation, it looks like you could just do something like:
RptLine.Height = someNewHeight
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I tried that Dave told me, but it's not work. May be I adjust at wrong time.
What time i should do it?
|
|
|
|
|
ok, i am writing a program for a class. it is supposed to be set up in a jeopardy type fashion. i am trying to get it so that whenever the user clicks on the button, then a form will pop-up refering to an excel spreadsheet to fill in the question to the appropriate text box and the answers to the correct text boxes also. i have the main form and then 1 form that is for the true/false questions and another form for the multiple choice questions. any help would be great. if you would like to see the program to better understand what i am talking about, please e-mail me. thanks
matthew davis
|
|
|
|
|
Help with what? You haven't said anything abbout what your problem is...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
making the forms get information from an excel spreadsheet and then put the info in the right text box
matthew davis
|
|
|
|
|
Matt,
a) You've got a bit of work ahead of you.
b) you're in the wrong forum, this one is for VB.NET
c) anyway, here's a class and some code I used to read and write to Excel files.
----
Option Explicit
Public sFileName As String
Dim sCurrentWorksheet As String
Dim bExcelWasRunning As Boolean
Public oExcel As Object
'Sub EnterValue()
' Worksheets("Sheet1").Cells(6, 1).Value = 10
'End Sub
'The Cells property works well for looping through a range of cells, because you can substitute variables for the index numbers, as shown in the following example.'
'Sub CycleThrough()
' Dim counter As Integer
' For counter = 1 To 20
' Worksheets("Sheet1").Cells(counter, 3).Value = counter
' Next counter
'End Sub
Public Function Init(ByVal asExcelFileName As String) ' , ByVal asCurrentWorksheet) as boolean
' Get handle to currently loaded instance of Excel if there is one.
Init = False
bExcelWasRunning = False
Err.Clear
On Error Resume Next
Set oExcel = CreateObject("Excel.Application")
If Err.number <> 0 Then
MsgBox ("Could not start up Excel. [E9810180901]")
Exit Function
End If
On Error GoTo OpenError
If asExcelFileName = "" Then
Dim xlWb As Object
Dim xlWs As Object
Set xlWb = oExcel.Workbooks.Add
Set xlWs = xlWb.Worksheets("Sheet1")
Else
sFileName = asExcelFileName
On Error GoTo OpenError
oExcel.Workbooks.Open asExcelFileName
On Error GoTo 0
Err.Clear
End If
Init = True
Exit Function
OpenError:
MsgBox ("Error while opening the Excel file: " & asExcelFileName & " " & vbCrLf & vbCrLf & Err.Description)
Init = False
End Function
Public Sub destroy()
' Shut down word if we loaded it ourselves, otherwise don't shut down an app we did not load.
If Not bExcelWasRunning Then oExcel.Quit
End Sub
----
----
' some mainline code that uses the class above.
dim objExcel as clsExcel
Set objExcel = New clsExcel
Call objExcel.Init(txtExcelInputFile.Text) ' open the file...like c:\mydirectory\SomeExcelFile.xls
Dim s As String
On Error Resume Next
s = objExcel.sFileName
If Err.number = 91 Then
MsgBox ("Please use File / Open Excel Input File Menu to connect to the Excel file you want to import.")
Exit Sub
End If
On Error Resume Next
With objExcel.oExcel.Worksheets(SheetID) '("Sheet1")
foo = .cells(1,5)
etc...
---------
Finally, you need to be careful pulling cell values from the spreadsheet.
The cell could be empty, not contain the datatype you think should be there,
or worse yet, may contain a formula.
Here's a wrapper function I wrote for pulling out what is suppose to be date-type data
Private Function GetDateField(ByVal sFieldName as string , ByVal iRow As Integer, Optional bReq As Variant) As String
Dim nCol As Integer
Dim s As String
Dim dt As Date
' bReq: is this field Required? if yes, and the data in the cell is missing, put out an error message.
If IsMissing(bReq) Then bReq = False
GetDateField = ""
' pass in the "name" of a field, look up in colInfo array within the application,
' obtain the column that data is in. Example: CityName is mapped to column 14, Salary to col 20, etc)
nCol = ColInfo(sFieldName)
If nCol = 0 Then
If bReq Then
' send error to the log file. the value is missing from the Cell, and it was a required field.
Call AppendError("Row=" & iRow & ", column " & quote(quote(ColInfo(nField, 1))) & _
" is missing from input Excel file. Please correct.")
End If
Exit Function
End If
s = Trim(objExcel.oExcel.Worksheets(SheetID).Cells(iRow, nCol).Value)
If s = "" Then
If bReq Then
Call AppendError("Row=" & iRow & " Column=" & nCol & ", Field " & quote(quote(ColInfo(nField, 1))) & _
" Field is empty. Please correct.")
End If
Exit Function
End If
On Error Resume Next
dt = CDate(s)
If Err.number <> 0 Then
' can't convert the date to a date, we're in trouble.
Call AppendError("Row=" & iRow & " Column=" & nCol & ", Field " & quote(quote(ColInfo(nField, 1))) & _
" Field is invalid: " & quote(s) & ". Please correct.")
Exit Function
End If
On Error GoTo 0
GetDateField = Format(s, "mm/dd/yyyy")
End Function
|
|
|
|
|
Hi, I use a TAB control in my VB.NET Project. I create three tab.
1. tbpSearchCat<br />
2. tbpSearchArt1<br />
3. tbpSearchArt2
But when I close my project and open the project again, my TAB control change the tab order to:
1. tbpSearchArt1<br />
2. tbpSearchArt2<br />
3. tbpSearchCat
I know it change because it sort the tab via the name of the tab (tbpSearchArt1 come before tbpSearchArt2 , and tbpSearchArt2 come before tbpSearchCat) I don't want to make it sort like that. I want to keep it remain as I create it. Can any one help me??
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I am having a bit of difficulty reproducing your problem, Do you have one tab control with 3 tab pages on it? Tab pages themselves do not have a tabstop, on the parent tab control does. Are you meaning the tab page that has focus after you close the project? Or am i up a completely different tree?
Cheers
Tom
|
|
|
|
|
Tom John wrote:
Do you have one tab control with 3 tab pages on it?
Yes that right. My problem is each page is not fix as it position. The first time that I design, I arrange it as an order. But when I start it again the first tab page become the second tab page. And the second tab page become the third tab page. I don't want to do that because it is not the way that I want. But I don't know how to show the problem.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Can you send me an example project cut down to the minimum required to illustrate the problem?
Cheers
Tom
|
|
|
|
|
OK, I create the blank project in vb.net. Then I drag the TAB control on the form. Then I create the TAB page via the tab item property. I created the following 3 tab pages:
tabSearch1<br />
tabSearch2<br />
tabSearchAll
And I want to display it on the form like this order:
tabSearch1 tabSearch2 tabSearchAll
But when I close the project and come back to work again it display:
tabSearchAll tabSearch1 tabSearch2
That is the order that I don't want to display. I like to display as the first time that I create it. Any idea???
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|