|
Following error:
System.ArgumentOutOfRangeException was unhandled
Message="Value of '25' is not valid for 'index'. 'index' should be between 0 and 20. Parameter name: index"
Thanks for your response... much appreciated.
Paul.
|
|
|
|
|
So there is an index with a certain size at any time.
Before you try to set the value of an element, just check that the index number of that element is smaller than the length of the array.
In pseudo code:
If the_index_number_of_the_item_you_want_to_check >= items.Count Then
'write to the item or not (I am not sure what you are trying to do)
End If
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Thanks again,
I think I understand, but please forgive my newbieness.
I dont know how to reference this index, I've tried several ways, but I feel like i'm shooting in the dark.
If WebBrowser2.Document.GetElementsByTagName("input").item(22) >= 1 Gives the following error:
I get an error value is not a member of 'System.Windows.Forms.HtmlElement'
What I thought I could do which also fails is:
If Exists WebBrowser2.Document.GetElementsByTagName("input").item(22) then ..... else ......
Paul.
|
|
|
|
|
WebBrowser2.Document.GetElementsByTagName("input").Count will give you the number of items at that moment. So that is the number that you can check against.
The question is, where / how / why did you determine to do something with item(22) specifically (22 being the key question here)?
In other words your code should look something like:
If 22 > WebBrowser2.Document.GetElementsByTagName("input").Count Then
'do something here
End If
Except that instead of 22 it really should be something like:
Dim i As Integer
'The value of i should become 22 due to some logic,
'but for the purpose of the conversation I am
'just going to assign it the value straight out.
i = 22
If i > WebBrowser2.Document.GetElementsByTagName("input").Count Then
'Item(i), in other words Item(22), does not exist
'Now that you know this, do what you want here.
End If
The test you ran earlier tells us that at that exact moment Item(20) was the maximum existing number. So you shouldn't be trying to write to Item(22).
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks very much works great now.
Paul.
|
|
|
|
|
Hi
While using source code from
http://www.codeproject.com/kb/dotnet/ShareObjDotNet.aspx
dll Nepal.utilities.Miscellaneaous is missing
Please provide dll
Thanks
|
|
|
|
|
You need to ask the author of that article via by posting a message at the bottom of the page you linked to.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi,
I have to create a form in VB/VB.net that can write records on a mdb file on my website and also retrieve records from it.
I have never done any web programming, so I want to know how I can do it. Are there any sample codes available on the web? or can someone suggest me a book which explains such work.
Thanks and regards,
Neil Ranjan
|
|
|
|
|
Well look at this
http://www.google.co.za/search?hl=en&q=Introduction+to+ado.net+oledb&meta=&aq=f&oq=[^]
Did you look at this ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Please do not post in two forums, with the same question. Very rude.
Select which forum you feel is most appropriate and post there, just there.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
I want to create log for both success and failure of transaction in database and not only for exceptions(errors)
In Enterprise Library, Can i do logging in case of exceptions only?
Thanks
modified on Thursday, July 30, 2009 3:20 AM
|
|
|
|
|
Stick your logging into the finally block
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You mean using enterprise library I can do the logging out of catch block also?
Can u please provide me link for the same? Actually i am searchin for the articles and everywhere logging is done in catch block only and i think it is for exceptions only
|
|
|
|
|
It really isn't all that mysterious:
'Dim variables that you want to pass to the Catch or Finally clauses here,
'outside the Try Catch Finally block.
Try
'Your transaction takes place here
'Monitor any return value from your transaction (rows affected for example)
'and log success or failure based on the outcome here.
'Or if no errors occur you can simply log success here
Catch ex As Exception
'if an error occurs log the error here
Finally
'if you want to log something, no matter what happens, do it here.
End Try
My advice is free, and you may get what you paid for.
|
|
|
|
|
Please confirm that the code is also for logging using Enterprise library.
Also can u provide a sample code link that tells that the logging in Enetrprise library can be done in any part of the function?
|
|
|
|
|
Having no experience with Enterprise Library myself, I would guess something like:
Dim logEntry As LogEntry
Try
'Your transaction takes place here
LogEntry = New LogEntry()
logEntry.EventId = 100
logEntry.Priority = 2
logEntry.Message = "Success or failure"
logEntry.Categories.Add("Trace")
logEntry.Categories.Add("UI Events")
Logger.Write(logEntry)
'Or
LogEntry = New LogEntry()
logEntry.EventId = 100
logEntry.Priority = 2
logEntry.Message = "Success"
logEntry.Categories.Add("Trace")
logEntry.Categories.Add("UI Events")
Logger.Write(logEntry)
Catch ex As Exception
LogEntry = New LogEntry()
LogEntry = New LogEntry()
logEntry.EventId = 100
logEntry.Priority = 2
logEntry.Message = "Error"
logEntry.Categories.Add("Trace")
logEntry.Categories.Add("UI Events")
Logger.Write(logEntry)
Finally
LogEntry = New LogEntry()
logEntry.EventId = 100
logEntry.Priority = 2
logEntry.Message = "Anyway"
logEntry.Categories.Add("Trace")
logEntry.Categories.Add("UI Events")
Logger.Write(logEntry)
End Try
My advice is free, and you may get what you paid for.
|
|
|
|
|
I am doing in window aplication.
Got teh folowing crash by execution the code provided by you.
The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Logging.Logger'
threw an exception.
I am uisng the following Dll reference.
Microsodt.Practices.EnterpriseLibrary.Common
Microsoft.Practise.EnterpriseLibrary.Logging
Is there anything that i need to do in addition to the above said
|
|
|
|
|
Adapt your code a little to include MsgBox(ex.ToString) in the Catch clause.
It will tell you in much more detail what the error is, and on which line it happened.
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi,
i have an application which will copy an image file from clipboard to Image.Text in vb6. now, i want it to try in vba and has error which is run-time error '424'. so what i did is i add reference library in tools. and still the same.
in vb6 this will work.
Me.Image1.Picture = Clipboard.GetData(vbCFMetafile)
but, in vba
Me.Image1.Picture = Clipboard.GetData(vbCFMetafile) => error here
my question is what vba equivalent of
Clipboard.GetData(vbCFMetafile)
thanks in advance.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Here[^] is the answer you need.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
thank you so much for the link and it helps me a lot.
i found out in the link that it cannot get data from clipboard only text, right? what i mean is that
(vbCFMetafile) is an image file.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
My pleasure! I think what you need is this[^].
Good luck!
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Sir i need help regarding restricting of loading of new form unless my form which is open is closed. For example i have 2 forms form1 and form2 in MIDI.
If form 1 is open i want to restrict user to open form 2 unless form 1 is close
Parag
|
|
|
|
|
You can use a Global boolean which you will set upon form opening and reset upon form closing.
In each form's Load event you can check the boolean: if it's not set, you can proceed opening the form and set it, if it's already set you can close the form.
I don't think VB6 has a more elegant way of doing this. :P
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hi to all
i would like to know about some VBA and excel. I would like to create a form and i would like to use excel as my database. How am i suppose to code it and update the "database". Before updating the database i have a Txt file from my TCS system as it only generate txt file. In this file there are lots of space, comma and semicolon. therefore the code need to delimite the space, comma as well as semicolon. how am i suppose to do it?? besides updating, in the form i need to read the data as well. so how to read the data from the database, maybe is it like C# SQl where they is a need of some store procedure. and for some part i would like to read selected column. once again how am i suppose to code thanks
once again thanks my dear friends
Warm Regards
Veon
|
|
|
|