473,385 Members | 1,359 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,385 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 1359
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!...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?

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.