|
Hi Steve,
First thing that comes to mind with your code (although it hasn't got anything to do with the problem) is that you really don't have to use me. everywhere, and MessageBox.Show doesn't need .Show .
As for the actual problem though:
steve_rm wrote: 'Load all the components into the grid
Private Sub LoadAllSoftware()
Try
Me.TA_Software_dsComponent_Equipment1.Fill(Me.DsAddComponetAndEquipment1.Software)
Me.dgvSoftware.DataSource = Me.DsAddComponetAndEquipment1.Software
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
You could try:
<br />
dgvSoftware.DataSource = DsAddComponetAndEquipment1<br />
dgvSoftware.DataMember = "Software"<br />
or alternatively you could try:
<br />
dgvSoftware.SetDataBinding(DsAddComponetAndEquipment1, "Software")<br />
steve_rm wrote: [2005]
I take it that you mean that you are using .NET 2005? Unfortunately my boss doesn't want to invest in the upgrade yet, so I am still looking at it from the .NET 2003 point of view. Therefore it is ofcourse possible that my code doesn't apply for your environment anymore, but otherwise, are you sure that .fill actually empties the dataset first before filling it again? For me that doesn't work, I still need to call DataSet1.clear() first.
Now if binding works when your form is loaded, than maybe you should think of doing the .fill thing only once (at the beginning), copy the whole dataset into a temporary dataset, and just copy the temporary ds back to your main ds when the user presses the reset button.
The active data binding should take care of the rest.
Hope this is of use to you,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks for your reply and advice.
Steve
|
|
|
|
|
I'm using this
rtbText.SaveFile(currentFile, Word.WdSaveFormat.wdFormatDocument)
it saves it ok but when I try to open it in word it ask if it can install a converter I click No then the document is shown but now whan I click save it ask tells me that it will save it as a text document.
All I want to do is save the text in the .doc format, why is it proving so difficult?
|
|
|
|
|
Anybloodyid wrote: All I want to do is save the text in the .doc format, why is it proving so difficult?
Because the RichTextBox can't save anything in Word's .doc format! The RTB doesn't know anything about it. All it can do is save as straight text or RichTextFormat, or RTF.
Word can load either type of document, but it'll ask you which format you want to resave it in when you go to do so.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
So basically there are three options open word, save doc, close word.
Open word, save as RTF.
Don't bother with word.
|
|
|
|
|
Yep.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Well, it's done, I can finally save a word document from my application
And then open it in word as a word.doc.
|
|
|
|
|
Actually, you saved an RTF file with a .doc file extension. It's not really a Word document. It's just in a format (RTF) that Word happens to know how to load and interpret.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
So, what you're saying is that when I write a document in MS word and do a SaveAs and choose.Doc, it actually saves it as an Rtf and sticks on a .Doc extension.
What's the point of that?
I might as well save in another format called .Mxt (My Extension)
|
|
|
|
|
I thought you were saving this out of a RichTextBox. In that case, an RTB only knows two formats: Text and RTF.
If you're saving out of Word, it'll save in its own proprietary format, with the .doc extension, RTF, Formatted and Unformatted Text, HTML, and a few others.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes that's it, I copy to clipboard, open word, paste and save, but I now do it without having the SaveAs dialog from word opening.
|
|
|
|
|
i have added a text file in my project.
hw can i make the opening of text file under a click event as we do in forms
dim a as new form
a.show()
|
|
|
|
|
mns01 wrote: hw can i make the opening of text file under a click event as we do in forms
What exactly do you mean by that? A text file is somewhat inert. You need something to perform an action on the text file. The text file itself cannot do anything on a click event.
|
|
|
|
|
You need to write a form which loads the text file from the resources and shows it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
You're kidding me?
|
|
|
|
|
Nope - the C++/CLI forum tends to attract standard C++ questions from people who are, well, new. They don't know what C++/CLI is, and perhaps get confused by the 'visual C++' forum's name.
But, this was definately a standout classic.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i dnt knw wats wrong wid ya people...
this problem is as simple as opening a new form when we click a button.
its jst nw in place of form v have a text file , which i have already added by 'adding new object' option....
its jst that i dnt knw the procedureand m askin is it possible or not..
|
|
|
|
|
mns01 wrote: dnt knw wats
mns01 wrote: wid ya
mns01 wrote: jst nw
mns01 wrote: v
mns01 wrote: jst
mns01 wrote: dnt knw
mns01 wrote: m askin
Please do not write in "txtspk". This is not a chat room, nor a text message. By writing in "txtspk" it makes your message more difficult to understand, and marks you out as being lazy or willing to take unecessary shortcuts.
mns01 wrote: i dnt knw wats wrong wid ya people...
There is nothing wrong with us. Insulting those who are tying to help you is not conducive to receiving a satisfactory answer. And, as you will see from the rest of the message, the question is not as simple to answer as you might think (assuming, of course, that the assumptions that I've made about what you actually want to do are correct)
mns01 wrote: this problem is as simple as opening a new form when we click a button.
its jst nw in place of form v have a text file
You want to open a text file. And apparently this is as easy as opening a form. Since a text file is, as I've said before, inert then you need something to act on it as it cannot perform any actions itself. So, I'm going to make a guess that you want to open a form with the text file loaded into it. Is that right?
So, create a form, with a large multi-line text box in it.
In the form's Load event handler you will load the text file into the form.
mns01 wrote: which i have already added by 'adding new object' option....
Exactly how did you add that? As content (in which case it gets copied to the same directory the exe is built into) or as a resource (in which case it gets embedded into your exe)?
Depending on how you added it, changes the way you get to show it.
|
|
|
|
|
Thanks colin...
for giving such a nice reply and solving my problem.
|
|
|
|
|
I am not sure if this will solve your problem. Why not show the contents of the textfile in multi-line textbox?
|
|
|
|
|
I'm still struggling here. Please bear with me.
I have a main .exe file with two classes: Class A and Class B
I have an assembly .dll file with one class: Class C
Class A in the .exe calls Class C in the .dll
Is it appropriate for Class C (.dll) to then call back up to Class B in the .exe? Or is it only appropriate to put Class B in its own assembly where Class C can call it .dll to .dll?
Thank you
|
|
|
|
|
cstrader232 wrote: Is it appropriate for Class C (.dll) to then call back up to Class B in the .exe?
If it does you have a circular reference between assemblies. This indicates that you have either not put the classes in the correct assemblies, or that your design is incorrect.
cstrader232 wrote: Or is it only appropriate to put Class B in its own assembly where Class C can call it .dll to .dll?
It all really depends on the relationship between the classes. If A, B and C represent different tiers of the application (e.g. A is the presentation layer, C is the business layer and B is the data layer) then they should go in different assemblies. But if B and C both represent different parts of, say, the business layer then they should be in the same assembly.
|
|
|
|
|
Oh, I think I forgot to mention something important, which is that the assembly is not linked to the .exe via imports in the .exe -- it is only 'discovered' via reflection at runtime.
|
|
|
|
|
It really is a lower-level assembly, which is part of my confusion. I'm having trouble figuring out how to tell the .dll to callback to the host, because the .dll of course doesn't know of the host's existence.
After I link the .dll via reflection, I've been passing the host name as an object from the .exe
initializeassembly (Me, ClassB)
to the .dll:
public shared host as object
public shared ClassB as Object
sub initializeassembly (host, ClassB)
me.host = host
Me.ClassB = ClassB
end sub
then I can call back up to the main from the .dll:
either the calling class
Me.host.method()
or another class in the main:
me.ClassB.Method()
But this procedure seems to not be that reliable.
I was told to use a delegate, but I don't see how that solves my problem(s)!
Does this make any sense?
thanks again.
|
|
|
|
|
cstrader232 wrote: I'm having trouble figuring out how to tell the .dll to callback to the host, because the .dll of course doesn't know of the host's existence.
Have a look at events. Think of the way controls on forms inform your code (which obviously, the button, text box or whatever, knows nothing about) of things happening to them.
Or, you could have the host implement an interface that both host and dynamically loaded assembly know about. Have a look for information on the "Plug in" pattern to see how to do that.
|
|
|
|