|
|
programmer1.a wrote: Please I need to help me
That's right, self help is the best way.
No-one here will code for you.
programmer1.a wrote: a simple example on a To Do List application
1 x Pencil
1 x Piece of Paper
Ta da!
A To do List.
Top of that list...
Learn to write some very basic code
------------------------------------
"Children today are tyrants. They contradict their parents, gobble their food and tyrannize their teachers. I despair for the future."
Socrates 400BC
|
|
|
|
|
OK..Thank you for reply
And iam sorry for the bad writing in English because I speak Arabic.
|
|
|
|
|
You language is not a problem, many here do not have English as first tongue, but never ask for code, write some code, then if there is a problem copy it here and ask for help, many people will be pleased to help or offer advice.
They might even RE-WRITE part of the code for you, but they will not just give it to you for nothing.
They need to see you have done some work.
------------------------------------
"Children today are tyrants. They contradict their parents, gobble their food and tyrannize their teachers. I despair for the future."
Socrates 400BC
|
|
|
|
|
hi ..
modified 28-Nov-12 8:17am.
|
|
|
|
|
Try changing
For fileCount As Integer = 0 To theFiles.Length() - 1
to
For fileCount As Integer = 0 To theFiles.GetUpperBound(0)
I'm assuming the error is an index out of bounds one.
If not, what is the error?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
Then either the input line is not as expected (e.g. blank line somewhere in the file) or p(1) has not been set correctly.
I suggest setting a breakpoint on the line, pressing f5 and looking at the values of s and p(1) in the locals window.
That should tell you which it is.
I did have a problem in GetColumnPostions because of the accent in "Nom du Modèle" not matching the text in a test file - it set p(1) to -1.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
I have solved this problem but not the previous one...
|
|
|
|
|
hi ,
i am new to this programming world...
i have been asked to create a simple VB application which uses a COM application written in vc++..
For eg., addition program..
VB gets two input. COM processes them and returns the answer to the VB and VB displays the answer.
does anyone know how to write code for that?? some tutorials or sample applications will be more helpful.
rakesh
|
|
|
|
|
You have to create an instance of the COM class in your code, then you can call the methods and properties of the object. Add a reference to the COM library, under My Project, References tab.
Then you import the namespace at the top of your code. Once you have that, it's as easy as creating any other object:
Dim s As New MyComObject
|
|
|
|
|
Hello all:
I am hoping someone might be able to shed some light on this!
I wanted to pass the following string as a sql query in VB6 (it is not by choice I am doing this in vb6, it is an old app)
sql = "Select enteredvalue from Eln_property_values where property_key = 2381 and section_key IN (select primary_key from eln_sections where Name = 'Version Overview Page' and section_set_key IN (select Target_key from eln_references where Collection_key = 25))"
the strange thing is when the string is created it becomes: (the issue is at the end)
sql = "Select enteredvalue from Eln_property_values where property_key = 2381 and section_key IN (select primary_key from eln_sections where Name = 'Version Overview Page' and section_set_key IN (select Target_key from eln_references where Collection_key = "
It seems to drop the value and the two parentheses. Strange??
Even stranger is if I replace "...Collection_key=25))" with ...Collection_key XYZ))" it becomes ...Collection_key XYy". I have no idea what is happening (I do not have alot of experience with VB6).
I am pretty sure I could break up the nested sql and run each select separately, but that does not seem like a great fix as there will be some unnecessary code and three recordsets opening and closing. Any help or thoughts would be most welcome,
Thank you
|
|
|
|
|
My guess is that strings are limited to 255 chars.
But it's quite a while since I did VB6 that I can't remember.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
riced-
Thank you for the response, I think you may be right. I thought this might be a possibility but was not sure with my limited vb6 exposure. I guess it is time to break this string up,
Thanks again
|
|
|
|
|
I don't think that is correct... limitation on string length certainly does not explain why the last "Z" became a "y"!
IIRC, VB6 strings are 64k in length. Text fields in MS Access (not sure about the version...) are limited to 255 char.
HTH
|
|
|
|
|
ChandraRam-
Agreed. But the 255 limit did get me on the correct path. I did some further digging within the application and found that the string itself is preserved during the pass, but in fact the Watch window itself only displays 255 characters and will mutate a string that is longer than that.
Thank you for all the replies...
|
|
|
|
|
@ChandraRam: No, There is no 64 K limit. If you like, try in a new, empty project, the following code snippet in "Form1"
Option Explicit
Private Sub Form_Load()
Dim str As String
Dim i As Integer
str = "x"
For i = 1 To 30
str = str & str
Debug.Print Len(str)
Next i
End Sub
my string grewed was 130 million characters in size, before an error occured.
|
|
|
|
|
hi ..
modified 28-Nov-12 8:21am.
|
|
|
|
|
Your code makes two assumptions:.
1. The file is sorted so that similar records follow one another and are in date order.
2. There will only be two similar records in the file.
The first is obviously incorrect given the sample input. The second might be incorrect, not enough information to tell.
There is also a problem with your date comparison. It is actually comparing two string variables (dateTime and dateTime1). This means that 01/06/2009 comes before 30/05/2009, so you will get the wrong date (assuming that not all creation days are the same).
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
To compare the date fields you need to convert them to Date variables, something like
Dim created As Date
Dim created1 As Date
created = CDate(dateTime)
created1 = CDate(dateTime1)
and then compare created with created1.
vijay2482 wrote: There many be many conditions like this.
Does this mean that the comparisons (other than the dates) might be different?
In other words 'What is it that makes two lines count as similar'?
There's two possible approaches to the problem that I can see, both involve the use of a list.
1. Read the whole file into a list, sort the list, remove the unwanted lines, then write the list out to file. This would mean that the output lines are not necessarily in the same order as the input lines. If that is important it can be got around.
2. Read the input a line at a time. Check if the list contains a matching record. If it does not, add the line to end of list. If it does, check the dates, if the line just read is earlier than the one in list do nothing otherwise replace the list entry. When all lines have been read, output the list.
Either approach is best done using a typed list and an appropriate structure or class to hold a data line. I can't think of a way that your existing code could be modified to deal with this problem.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
Are you using CDate(dateTime) as in example?
You can't do this: created = dateTime . But you should be able to do this created = CDate(dateTime) provided dateTime holds a string that is a valid date/time.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|