|
I'm in the process of converting an application written in VB from VS2003 to VS2005, which has numerous random access files and structures. I am receiving warnings that read "Implicit conversion from 'System.ValueType' to StructureName in copying the value of 'ByRef' parameter 'Value' back to the matching argument. The application does function as designed, but I would like to correct the code to remove these warnings.
I have been searching the internet for weeks and have found many folks with the same problems, but no solutions have been posted. A sample of the associated code is listed below. With the statement
"FileGet(intCarFileNum, MyCellCarriers, intL)", the structure "MyCellCarriers" is underlined in green.
Any suggestions would be greatly appreciated.
Public Structure struCellCarriers
<vbfixedstring(3)> Public cIndex As String
<vbfixedstring(1)> Public cSep1 As String
<vbfixedstring(48)> Public cCarrier As String
<vbfixedstring(1)> Public cSep2 As String
<vbfixedstring(1)> Public cCR As String
End Structure
Public MyCellCarriers As struCellCarriers
intCarFileNum = FreeFile()
FileOpen(intCarFileNum, strCarFile, OpenMode.Random, , OpenShare.Shared, Len(MyCellCarriers))
intCarRecCnt = LOF(intCarFileNum) / Len(MyCellCarriers)
cboCellCarrier.BeginUpdate()
cboCellCarrier.Items.Clear()
For intL = 1 To intCarRecCnt
FileGet(intCarFileNum, MyCellCarriers, intL)
With MyCellCarriers
If .cCarrier.Trim > "" Then
cboCellCarrier.Items.Add(.cCarrier.Trim)
End If
End With
Next intL
FileClose(intCarFileNum)
|
|
|
|
|
how to add a msfgrid in VB.Net.
|
|
|
|
|
where are you struggling?
|
|
|
|
|
hi,
i didn't find msfgrid in components.
|
|
|
|
|
it comes with vb6 so if you have that, install it then you will have it available to you. otherwise...
|
|
|
|
|
ActiveDocument gives error whenever i open any existing document..
CType(applicationObject, Word.Application).CustomizationContext = CType(applicationObject, Word.Application).ActiveDocument
CType(applicationObject, Word.Application).ActiveDocument.Saved = True
oh !! i missed out the important part..
well this works fine when i go:- start-> run-> winword
it works fine when i go with debuging..
but if i run existing document by double clicking... it gives error .. specifying activeDocument not exist..
-- modified at 2:24 Thursday 19th October, 2006
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Where are you calling the function?
If you have opened a document prior to calling ActiveDocument it should work.
If there's no documents opened at all by Word it will return the error you mentioned.
And why do you keep boxing the applicationObject several times? You should cast it into a Word Application object and use it as it's more efficient this way.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
huh !! finally some one repled !!
OK now first boxing.. i'll do follow ur suggesion...
i'm calling this function from OnStartupComplete..
well i;ve tried an another way, used WindowActivate event of word object to add commandbar .. well it does work in case of opening existing document but as WindowActivate event fires several times it makes my addin slower..
hence i've set the object to nothing .. which causes event to be fired once.
You might thought, so whats the problem..??!! well, as soon as i set object as nothing.. it stops futher firing generating NewDocument event or anything else..
So .. no more addin loaded in new Document generated by clicking on new.
HELP...
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Please do us a favour and make your message easier to read, then we will be more inclined to help.
If you're calling the function on the OnStartupComplete of Word, then of course it will return an error as there is currently no ActiveDocument yet (i.e. no document is opened).
You should call the function on appropriate events such as when a document is opened or new document is created. This way you can be sure that there is an Active Document.
If you need further help, you probably might want to explain what is it that your function is doing.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
My prob. starts with a looong histry..
First of all i;ve created word addin.. which when removed leaves the trace behind. I mean my_button(added in File Menu) is left there on word document.
I solved this NOTORIOUS problem using Normal.DOT way, like this
[CType(applicationObject, Word.Application).ActiveDocument.Saved = True]
and it get solved.
now, the problem occurs whenever i open and existing document.
Reason: As there is no ActiveDocument, the code above gives me an error
To solve this problem, i've used word document's WindowActivate event to add my button to file menu, by following way..
OnStartupcomplete, i assigned application-Object to objW, like this,
wObj = CType(applicationObject, Word.Application).Application
and then add my own menu button to File-Menubar of word, like this:
[applicationObject.CommandBars.item("File").Controls.Add(MsoControlType.msoControlButton, 1, "", 6, True)]
well, i do check of if button already exists or not.
Now Problem arouse, as WindowActivate Event fires many times, that makes my pgm sick. So in solution of that, i have set objW = nothing
which causes No more WindowActivate event(Only once) and still code runs fine.
Setting objW = nothing raises one more error:
Now as i create a new Document from File>New, the addins button not loaded in it as no event fired !
I'm trying all different events for this and different approaches for this, but all invain.. of no use or just not working..
Your replies gives me new hope to work on for the solution.. thanks for ur replies... if u find any line confusing .. do ask .. Thank you
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Ok, let's see:
Kedar V wrote: First of all i;ve created word addin.. which when removed leaves the trace behind
You should add the buttons as temporary buttons only (in your code) so they disappear when your add-in is removed/not working.
Kedar V wrote: he problem occurs whenever i open and existing document.
Reason: As there is no ActiveDocument, the code above gives me an error
You probably called your function in the wrong event. The DocumentOpen event should have an ActiveDocument in it (which will be the document you've just opened). And obviously placing your code in WindowActivate is the wrong step.
You also only need to add your button ONCE, not multiple times as this works in all instances of the documents, so I recommend in your function to check whether the button already exist or not. If yes, then do not add/attach the event anymore.
Your application probably slowed down due to multiple event handlers being attached to the same button.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
"...buttons as temporary buttons only (in your code) so they disappear when your..." > this is not the case with WORD as it saves every thing in the tamplete, normal.dot , and i have already solved it, as stated code earlier !
Also there are no multiple button being displayed as ive done proper CHECKing..
the only prob. i have is: button not show-up in existing word document !!! or whatever i;ve stated in earlier reply..
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hi
how to decrypt the which has hashed using SHA256
3DES may help
thanks
|
|
|
|
|
You can't decrypt it. It's a one-way only encryption used for storage, not message transfer. The only way to find out what's in it is to guess at the contents, hash your "guess" using the same algorithm then compare the hash value to the one you want to "decrypt". If the guess is wrong, change your guess, rehash it, and do the comparison again. Rinse and Repeat. This will probably takes a couple years...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I think he asked the question a couple of days ago - But he obviously didn't like the answer then.
|
|
|
|
|
Yeah, but maybe if we keep using bigger hammers, he'll get the idea!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ravimorampudi wrote: how to decrypt the which has hashed using SHA256
You already asked this[^]. The answer is not going to change. Perhaps you might like to read a book on cryptography and find out exactly WHY you cannot do what you are asking.
There may be a work around to your situation. If you can tell us what overall goal you have we may be able to come up with a better solution for you.
|
|
|
|
|
I'm new to VB.Net and in VB6 I could remotely populate a combo from another form using the forms name and combo name.
When I try the same thing in VB.Net the routine runs alright but the combo never gets populated.
If I run the identical routine in the target form it works perfectly. It just seems that I have problems access objects on other forms
The syntax is correct ie
OtherFormName.ComboName.Items.Add("WhatEver")
DataGridView seems to be the biggest problem refusing to accept focus until I physically click on the darn things. I think it may be all related to the combo thing. Somehow I think each form has it's own class and I have yet to work out how to access a function belonging to the other forms class.
for example:
OtherFormName.DataGridViewName.focus
or
OtherFormName.FunctionName()
I have tried setting the objects Modifier to Public etc.
Hope this makes sense.
Any Help would be gratefully appreciated.
John
johngod@dodo.com.au
|
|
|
|
|
In the forms designer, change
Friend WithEvents TxtProductionBgColor As System.Windows.Forms.TextBox
to
Public WithEvents TxtProductionBgColor As System.Windows.Forms.TextBox
You can also make a public routine populate the control and have form1 call form2.
hope this helps.
nathan
|
|
|
|
|
Hi,
How can we develop a custom word document in .Net? Where i dont have Microsoft Word installed in my system and i want to generate the reports in document like word and submit to clients. Can anyone suggest me how to proceed for this or a solution!
Thanks in Advance!
|
|
|
|
|
If you don't have Word installed then you cannot use Word Application object and documents to create custom Word documents.
You might want to check RTF format or the new Word XML format (only for Office 2003 and above) to create documents without using MS Word. It's not an easy task, as far as I can tell.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
Hi Edbert,
Thanks for reply,
Can u gimme the solution how we can proceed with RTF format or NotePad kind of document.
Thanks in Advance!
|
|
|
|
|
Unfortunately I'm not an expert in RTF format.
You might want to check documentation on RTF yourself.
I've seen it and I can tell you it's not easy and you won't be able to do 100% of everything you can do in Word format.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
Hey,
I was writing a program and it was working fine. Then I deleted a form and an error ocurred saying:
<br />
Invalid Operation Exception Was Unhandled<br />
<br />
An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.<br />
This has happened before with Performance Counters, but I haven't used one. Also, I remove varibles that are outside Sub Procedures (ie. Private Varible1 As String and this makes it work again. And it will also completely clear AplicationEvents.vb.It happens very randomly.
Any ideas? This is a huge program and I would hate to have to start over on it (like I have done many times before). Please help.
Thank you!
|
|
|
|
|
Hi All,
I'm facing a problem here which is I'm using the same Setup file for my VB.net project to install in 2 different OS which are win 98 and win xp, when I run it, win xp not facing any problem, it can success load the report, but when I try to run the exe file in Win 98, it have error which is "Load report Failed". Why can be like this, I'm using the same setup file for this 2 computer why win xp can load but win 98 cannot view?
|
|
|
|