|
Errr...no
Sometimes it needs only three sections, sometime ten. Once it was 22!
So I get (a*b)+(c*d)....20 more of these...+(xx*zz)
It is too long and too much effort.
A simpler function is better.
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
OK. I got it. You're right, too much of a pain in the @ss to do each month.
So what is stopping you from writing the function ?
Jump in head-first into VBA !
|
|
|
|
|
Here is what I have but it is not working yet...
Public Function FACTOREDTOTAL(NumberOfCols As Integer, CellKey As Range, CellsAcross As Integer) As Variant<br />
Dim Answer As Double<br />
Answer = 0<br />
Dim PartAns(NumberOfCols)<br />
Dim AnswerCell As Range<br />
ActiveCell.Select<br />
AnswerCell = Selection<br />
For a = 0 To NumberOfCols<br />
Range.Offset(0, 0 - a).Select<br />
PartAns(a) = Selection.Value * Selection.Range(CellKey.Offset(0, -a)).Value<br />
<br />
Answer = Answer + PartAns(a)<br />
Next a<br />
Range(AnswerCell).Select<br />
Selection.Value = Answer<br />
<br />
End Function
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Hi all i'm kind of a newbie. I need some help iterating through the records of a random access file . Like a next and previous button, and deleting records in the file.
Here is the code that i have thus far please help.
Next:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Employee As Company, Count As Integer
Filenum = FreeFile()
FileOpen(Filenum, "Filename.dat", OpenMode.Random, , , Len(Employee))
Filenum = frmedit.lblrecord.Text
Count = 1
frmedit.lblrecord.Text = Count
If EOF(Filenum) = False Then
FileGet(Filenum, Employee, Count)
txtcompanyname.Text = Employee.Name
txtstreet.Text = Employee.Street
txtsuburb.Text = Employee.Suburb
txttelephpone.Text = Val(Employee.Telephone)
txtfax.Text = Val(Employee.Fax)
txtemail.Text = Employee.Email
Count = Count + 1
Else
MsgBox("End Of File", MsgBoxStyle.Critical, "Error")
End If
FileClose(Filenum)
End Sub
Previous:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Employee As Company, Count As Integer
Filenum = FreeFile()
FileOpen(Filenum, "Filename.dat", OpenMode.Random, , , Len(Employee))
Count = 1
If Count <> 0 Then
FileGet(Filenum, Employee, Count)
frmedit.txtcompanyname.Text = Trim(Employee.Name)
frmedit.txtstreet.Text = Trim(Employee.Street)
frmedit.txtsuburb.Text = Trim(Employee.Suburb)
frmedit.txttelephpone.Text = Trim(Val(Employee.Telephone))
frmedit.txtfax.Text = Trim(Val(Employee.Fax))
frmedit.txtemail.Text = Trim(Employee.Email)
frmedit.txtncr.Text = Trim(Val(Employee.NCR))
Count = Count - 1
Else
MsgBox("Beginning Of File", MsgBoxStyle.Critical, "Error")
End If
FileClose(Filenum)
End Sub
Delete:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim Employee As Company, FileNum1, FileNum2 As Integer
FileNum1 = FreeFile()
FileOpen(FileNum1, "Filename.dat", OpenMode.Random, OpenAccess.Read, , Len(Employee))
FileNum2 = FreeFile()
FileOpen(FileNum2, "Genx.dat", OpenMode.Random, OpenAccess.Write, , Len(Employee))
Do While Not EOF(FileNum1)
If (Loc(FileNum1) <> Position - 1) Then
FileGet(FileNum1, Employee, )
FilePut(FileNum2, Employee, )
Else
FileGet(FileNum1, Employee, )
End If
Loop
FileClose(FileNum1)
FileClose(FileNum2)
Kill("Filename.dat")
Rename("Genx.dat", "Filename.dat")
End Sub
|
|
|
|
|
...and what's the problem? By the way, Random access files are a thing from the past. I would import the data into a database (Access at least) and manipulate it there.
Regards: Didi
|
|
|
|
|
I need to use random access files as it is for a school project. I whish I could use a database that would have been soooo much simpler but were workin on file handling.
The problem is that the code i posted isn't working don't know if you checked it out but it won't go to the next record or previous record and the delete works sort of but the filenumber isn't deleted and certain fields are just set to "0"
thanx: vurdmal
|
|
|
|
|
Well the first problem I can can see lies here
Count = 1
If Count <> 0 Then
Count is always going to be <> 0 because you've just set it. Maybe Count should be a global variable?
I would also a global variable for the Company object and populate the textboxes depending on it.
|
|
|
|
|
I understand the mistake and it is a stupid mistake actually but how wil i get the current recordnumber into the intger count.
Because I figure if I can do that the fileget wil have the current reccord and a quarter of my problems wil be solved.
Regards: Vurdmal
|
|
|
|
|
I presume Count is the total number of records that can be accessed? In which case I think that in your form load event you need to get this number and assign it to a global variable called 'Count' (sorry if I'm being patronising here but by 'Global' I mean a variable declared outside of any methods). Then declare another variable to keep track of which record you're currently looking at (again, Global).
Hope this makes sense.
|
|
|
|
|
I think that's one of my major problems I don't know how to keep track of the records.
I uploaded my project so you could see what I did, hopefully that would clarify things a bit more.
http://www.filefactory.com/file/ag38fg0/n/Document_editor_rar[^]
If it looks a bit junky it is because I ommited a few functions that hhas no relativiy to this post.
|
|
|
|
|
Well I need to leave now and go home. I will take a look at home if I get chance but, as this is a school project I am not going to give you the solution, I will however point you in the right direction if I can.
|
|
|
|
|
Hi Experts,
I would like to capture Harddisk and processor serial No. apply some algorithm over it and generate a new encrypted ID. Further I like to embed this ID to the installed exe. So that it check everytime the same hardware when it run.
Obtaining Serial No. is partly done by us but I dont know how to join this serial key in exe with encrypted mode.
I am using VS2005 and my project is on Vb.Net.
Thanks in advance.
Jay Khatri
|
|
|
|
|
|
hi didi,
I just have finished my project and started deployment. But I was failed to follow the instructions you had given. Can u explain by example.
Best Regards
Jay Khatri
|
|
|
|
|
I did never tried this myself, but would try it that way, if I had the same problem than you...
So, sorry, no examples from my side...
Regards: Didi
|
|
|
|
|
Hey
Im using an inno script create a setup.exe file.
What I want to do is: use a pascal procedure to get the names of the exe's I want to install and then with the run section run these exe's. The will be done for the dll's and ocx files.
Thanks for any help.
|
|
|
|
|
Akkedis wrote: What I want to do is: use a pascal procedure
So you ask about this in a VB.NET forum?? I think the first place I would ask something like this would be a forum that deal s specifically with InnoSetup. You might want to try their support forums.
|
|
|
|
|
Hi,
I'm using Visual Basic 2008 Express Edition. I done some google search on any guidance on how to write a Visual basic program to receive email, but without any success.
Can anyone kindly advise or guide me how to code the Visual basic program to receive/read email?
Thank you very much for your help.
|
|
|
|
|
Recieving email is not trivial. I don't think there's classes built in for that, just for sending it.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
You'll need to implement an SMTP server. The RFC is here[^] - you'll need to implement the server side commands.
|
|
|
|
|
Hi, I would try to search here[^] and see if there is something I can use.
Good luck: Didi
modified on Tuesday, June 2, 2009 4:56 PM
|
|
|
|
|
Um, no. SMTP is used to send mail. The poster wants to know how to receive mail; POP3 is the correct protocol
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
...you are absolutly right and I am a fool...
|
|
|
|
|
Hi,
Where can I find some information about creating an Excel XLL addin.
I have created many macros in VBA and now I want for security reasons convert it into a compiled format like XLL using VB.net 2008. It has to be easely distriutable for the other users. now I use a script on login. it checks if there is a new version. If so copy it into the addin folder. over the old version. The users see nothing happening on there computer. When Excel starts the new version is there.
Preferable in Dutch(Nederlands) or in English
Jan
|
|
|
|
|
Look here[^]
Regards: Didi
|
|
|
|