473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can I have a Ghost Control using Reflections.

Hi All,
I've finally getting into .NET and have a question for you all. I'm creating
an app that needs to insert user data into a word doc. One way I thought of
doing this was to save the Word Bookmark names, Control names and db field
names in a XML file. in the app I would like to be able to load those items
into memory and use these items to fill out the word doc without the code
knowing the name of the controls or db fields. Heres an idea of what I'd like
to do:
'Load XML file
While reader.Read()
Select Case (reader.NodeType)
Case XmlNodeType.Element
'Format(reader, "Element")
If (reader.Name = "ControlName") Then
Console.WriteLine(reader.ReadElementString()) 'goes
to console for now. But will save into some structure.
End If
If (reader.Name = "BookMark") Then
Console.WriteLine(reader.ReadElementString())
End If
End Select
End While
'Open the word doc
doc = ThisApplication.Documents.Open(FileName:=VB6.GetPa th & "Note.dot")
ThisApplication.Visible = True
ThisApplication.WindowState = Word.WdWindowState.wdWindowStateMaximize
''''The following line is where I need help.
'colItems.ControlName is the Name of the control that was found in the
XML file.
'colItems.BookMark is the name od the Word Bookmark.
doc.FormFields.Item(Word Bookmark).Result = ControlGhost(Word.
ControlName).Text

If I remember correctly, I beleive I read somewhere that with reflection
you could do something like this with the controls. Is this correct? If so,
how is the best way to go about that. Is there any articles that cover this
topic. Thanks for any help that you can provide.
Michael Lee

Jul 21 '05 #1
1 1362
Hi Everyone,
I'm back, I have found a few things. I think I'm getting closer, but not
quite there.
I found an article:
http://msdn.microsoft.com/library/de...usingtypes.asp
that talks about reflection. This is simular to what I would like to do, but
also wanted to see if anyone had an idea of how to get the text and value
property of any of the controls on the form.
Thanks for any help.
Michael Lee
"Michael" wrote:
Hi All,
I've finally getting into .NET and have a question for you all. I'm creating
an app that needs to insert user data into a word doc. One way I thought of
doing this was to save the Word Bookmark names, Control names and db field
names in a XML file. in the app I would like to be able to load those items
into memory and use these items to fill out the word doc without the code
knowing the name of the controls or db fields. Heres an idea of what I'd like
to do:
'Load XML file
While reader.Read()
Select Case (reader.NodeType)
Case XmlNodeType.Element
'Format(reader, "Element")
If (reader.Name = "ControlName") Then
Console.WriteLine(reader.ReadElementString()) 'goes
to console for now. But will save into some structure.
End If
If (reader.Name = "BookMark") Then
Console.WriteLine(reader.ReadElementString())
End If
End Select
End While
'Open the word doc
doc = ThisApplication.Documents.Open(FileName:=VB6.GetPa th & "Note.dot")
ThisApplication.Visible = True
ThisApplication.WindowState = Word.WdWindowState.wdWindowStateMaximize
''''The following line is where I need help.
'colItems.ControlName is the Name of the control that was found in the
XML file.
'colItems.BookMark is the name od the Word Bookmark.
doc.FormFields.Item(Word Bookmark).Result = ControlGhost(Word.
ControlName).Text

If I remember correctly, I beleive I read somewhere that with reflection
you could do something like this with the controls. Is this correct? If so,
how is the best way to go about that. Is there any articles that cover this
topic. Thanks for any help that you can provide.
Michael Lee

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes,...
2
by: Peter Flickinger | last post by:
I have been using a label with the TreeView control - to simulate the ghost image of a node during drag/drop (so that a ghost of the node appears to be floating next to the cursor on a drag/drop)....
1
by: Michael | last post by:
Hi All, I've finally getting into .NET and have a question for you all. I'm creating an app that needs to insert user data into a word doc. One way I thought of doing this was to save the Word...
1
by: Howard Kaikow | last post by:
It was my expectation that a sub using the usual recursive FindFirstFile/FindNextFile would be able to walk the directory tree on any logical volume. I am finding that this may not be the case...
0
by: arturbl | last post by:
I just finished my sort of MVC/P framework where I do url rewriting. During the url rewriting I access properties of the controller/presenter based on the url. First thing that most of us would...
2
by: Academia | last post by:
Within a sub can I determine the control that called it. I can add a parameter to the sub so that I call it: MySub(This, ... But I'd rather not.
0
by: fennelllindy8241 | last post by:
norton ghost crack
2
by: Geolas | last post by:
Hi, new to this community.I am not really sure if this was the right place, because this community seem to be for developers really. Well my question is, as the topic states, how to create a...
2
by: =?Utf-8?B?RHVhbmU=?= | last post by:
I unistalled Norton Ghost 14.0 and when I went to defrag my HD, I got this error -- basically saying it could not defrag the HD. Here are the specifics of my results. Any help is appreciated!...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.