When you visit Google, IE says something like Google - Microsoft Internet Explorer. However, if you changed the address to, say, Stack Overflow, it would say something like Stack Overflow - Microsoft Internet Explorer.
So, how can I make a dynamic title bar that changes with a variable?
You set the Form.Text, using the current instance (which you access using Me):
Dim SomeVariable As String
SomeVariable = "Site 1 - My Application"
Me.Text = SomeVariable
For future reference, you can figure a lot of this out by clicking on the object you want to change things on in the Designer and then looking at the Properties window. In this case, you'd click on your main window and then looking at Properties, where you'd find the "Text" property. Changing it in the Properties window would change it in the Designer immediately when you type new text and hit the Enter key or move to another property.
Related
Sorry I don't know how to name it other than "advanced custom properties". If I know, I would search it first.
I am dealing with a legacy code using 3-rd party controls.
In VB6, When you drag that control onto the form, you can see all the properties supported by the control in the "Properties" window. Such as MarginLeft, MarginRight etc. etc.
That's no problem.
In the "Property" window, the top-most property is generally the "(Name)" field, which is the name of the control.
But the 3-rd party control I am using, has another two "fake properties" above "(Name)", which are "(About)" and "(Custom)".
When you click "(About)", there will be a dialog box showing the company info. When you click "(Custom)", there will be another dialog box showing more properties. These dialog boxes are shown in VB6.
In the "(Custom)" dialog box, you can modify normal properties (same as modifying directly in the Property window). You can do more. There are more properties that are not normal properties (at least you cannot find anything in the Property window).
When you save this form, for normal properties, everything are saved into .FRM file. E.g.,
Control1.MarginLeft = 5
Control1.Text = "I am a control"
However, for the "advanced properties" edited in the (Custom) dialog box, they are not saved in .FRM, they are saved in .FRX in binary format.
E.g., in (Custom) dialog box, you can edit a property called "Caption", which includes text of this caption, the font, the weight, the display style, and a lot of similar properties for Caption. In .FRM, it is something like,
Control1.Caption = "frmForm1.frx":013F
All the text and related properties of Caption are saved in binary format in .FRX file.
Note that, there's no Caption property in the normal Property window, you can only edit it in the "(Custom)" dialog box.
My question is as follows,
How to implement such a (Custom) dialog box that can be shown in VB6?
How to let VB6's Property window display (About) and (Custom)?
How to tell VB6 that Caption property shall not be displayed in Property window, but you can use directly in code as Control1.Caption = xxxx.frx:offset?
How to tell VB6 that this Caption property shall be saved in .FRX, and how to tell VB6 the size of the data, so that VB6 can manages the offset automatically?
How to load the data automatically via VB6 so that the correct values can be displayed in (Custom) dialog box?
As far as I know, .frx formats are secrets, there are a lot of ppl digging into various .frx for standard controls such as Binary(images), List, and Text. I am curious how can a 3-rd party control utilizing .frx, shall the 3-rd party control define its own .frx format? Including for example, how many bytes in front for Length (or no length field at all, it's fixed length), how many bytes for style1, how many bytes for style2, etc.
Thanks a lot. If you know what proper name it is for this "advanced properties", just tell me the name and I can search myself.
I tried to search for advanced properties but didn't really get anything I want to know.
The frx files are for binary or other non-basic data types. The frm will store the simple properties. What you need to do is to hook into the UserControl events WriteProperties and ReadProperties. You don't need to know where the backing storage is (frm vs frx)., you just need to access the PropBag to read and write your data.
Google is your friend to find the documentation:
https://msdn.microsoft.com/en-us/library/aa242140(v=vs.60).aspx
Or additional information on the topic:
http://www.vbforums.com/showthread.php?365735-Classic-VB-How-do-the-ReadProperties-and-WriteProperties-work-(PropertyBags)&s=3cfbd675928ad1eb94f68fbfb13ccd88&p=3672781&viewfull=1#post3672781
Good luck!
I'm looking for an event that's raised when a user selects text in the preview pane of an email. E.g. you're viewing an email in the preview pane and select some text. I didn't see anything in the object reference to this effect, but the namespace is so large, it seems like there's always some object somewhere that does exactly what I need, which I'm not aware of.
Overall, what I'd like to do is see if the selected text matches a pattern and if so, insert a sub-menu in the right click menu (the one that says Copy, Who Is, Synonyms, Translate..). Help with this would be appreciated too. I believe the CommandBar is "text", but I'm unsure how to go about accessing this via name.
The Outlook object model doesn't provide anything for that.
Programming Environment: Visual Studio 2010
Programming Language: VB.NET
I have a tabbed web-browser that I add dynamically, I Dim the the web-browser every-time the user clicks the New Tab button, like this: browser = New WebBrowser() and give it a name based on the tab count, e.g. browser2, if there are 2 tab pages. So my question is - about time - that how would I get the Url of the WebBrowser, I have tried Dim UrlString As String = CType(tabMain.SelectedTab.Controls.Item(browser.Name), WebBrowser).Url.ToString But, correct me if I am wrong, I found that WebBrowser isn't classed as a Control, and the reason why I think this is because:
This gives me an exception: Object reference not set to an instance of an object.
So I tried looping through the controls in the tabMain.SelectedTab and found that the WebBrowser(browser) isn't included in the collection. The code I used to loop was:
For Each ctrl As Control In Me.tabMain.SelectedTab.Controls
MsgBox(ctrl.Name)
Next
Tried looping through all the Parent controls, but no sign of the WebBrowser showing up. Hope this is enough information =P
Thanks in advance.
UPDATE: Figured out the problem, really stupid, and my theory was bullshit too =P. Just ignore =] lol
try this.
Dim UrlString As String = CType(tabMain.Controls.Item(0), WebBrowser).Url.ToString
I assume tabMain is the name of the TabControl. If this is true and each tab has a WebBrowser Control in it then it should work.
I was wondering if there is a way to take an object in Visual Basic 2010 (Express, FWIW) and browse through its structure to visualize how the data inside is laid out.
For example, I have an object called "model" that is populated by a function that is a black box to me. Model is set by a "read" function that loads a DXF file from disk. The read function isn't very well-documented.
What I've discovered is that model.Entities ends up containing a list of different objects, all with different properties. I'd like to be able to simply browse this list of objects and view their associated properties and values at run-time, similar to how you can use Intellisense to view a list simply by typing "blah." and waiting for the pop-up to appear.
A tree view that you can pop open and closed would be excellent. Obviously this has to work during run-time rather than in the editor because the file hasn't been loaded if the program isn't running.
Is this something that's possible in Visual Basic 2010? Is it a built-in feature I can't find?
Thanks!
If a function returns an object, then that object has a class definition somewhere. Right-click the reference in VS and select "View in Object Browser" and you'll see the class layout with all properties and methods. You don't need to do this at run-time, either.
If you want to dig even deeper then you should check out Reflector.
EDIT
After reading your comments more, I usually do one of three things when I'm trying to do this:
Use the Autos and Locals window
Use the Immediate Window
Use "break-point and hover"
Use the Autos and Locals window
Set a breakpoint and check out the Autos and Locals windows. If you don't see them they're under the main menu at Debug, Windows. This allows you to walk a tree-view of your variables. Sometimes there can be a lot of stuff in here which I why I generally use one of the other two methods below.
Use the Immediate Window
The Immediate Window (IW) allows you to type in expressions and print out values. Its not a tree-view like you want but it allows you to hunt and peck at least. If you imagine the following short and simple code and you put a breakpoint on the second line:
Dim Names As New List(Of String)({"Alice", "Bob", "Chuck"})
Console.WriteLine(Names)
In the IW you could type:
?Names
And it would output:
Count = 3
(0): "Alice"
(1): "Bob"
(2): "Chuck"
The question mark symbol means "print". You can type almost any valid expression for print:
?Names(0)
"Alice"
?Names(0).Substring(0,1)
"A"
?Names(0).Contains("ice")
True
And as you're doing all of this you're getting IntelliSense about whatever is going on.
Use "break-point and hover"
I don't think this has a name beyond IntelliSense but once you've hit a breakpoint you can hover over any variable and inspect its current values. You'll get the occasionally warning that inspection will cause some processing but since you're debugging only this should be fine. Sometimes when I'm debugging a collection I'll create a variable specific to one item in the collection just to make this technique easier. I'll get rid of it once I'm done debugging but it really helps this process.
Is there another
Using Office automation in Word 2007, I view the Document Information Panel, showing me properties of a document that resides in a SharePoint location.
Using VS 2008, I interrogate the following in the Immediate Window:
? WordDocument.CustomDocumentProperties(23).Value
"My App Name Here" {String}
String: "My App Name Here"
Then I interogate the name of the property:
? wordDocument.CustomDocumentProperties(23).Name
"Process Name" {String}
When I type into the combobox and change the value to "YYY" and query the value of tghe property:
? WordDocument.CustomDocumentProperties(23).Value
"YYY" {String}
String: "YYY"
However, when I execute the following:
WordDocument.CustomDocumentProperties(23).Value = "New Value" and requery the value of the property I see that the value was stored:
? WordDocument.CustomDocumentProperties(23).value
"New Value" {String}
String: "New Value"
..but I don't see a corresponding change to the screen.
I do however see that, on Advanced Properties/Custom Tab that a Custom Property by the name of "Process Name" has been recorded with the value "New Value"
There seems to be some kind of one way mapping going on between "server" and "custom" properties, but the really strange part is:
I can update SOME server properties, others I cannot.
I don't know a darn thing about SharePoint, other than as a dumb user. And getting any help from a SharePoint admin in my company is probably a very long shot...
I checked all of Word's Built-in Properties and Custom Properties, I decided that none of them can be used to update the "Process Name" "server" property.
How can I update this stubborn property? Most of the server properties I can update, a few I cannot.
I see some articles referring to using what looks like "SharePoint objects." Do I need to download an SDK just to populate these properties? So far I've used Office automation, because I am running locally on the user's PC and pre-filling documents using the Word object model.
All that is left is to finish populating the last couple of server properties after I copied the doc to a Sharepoint folder.
Your issue comes from how SharePoint maps its properties to the Office 2007 document and vice-versa.
Ideally you would navigate to the web site and list of where your document is stored. (e.g. shortent http://intranet/[somesharepointstuff]/mydocument.docx to http://intranet/[somesharepointstuff]).
If a page display, you will be able to find your document and edit some properties there hopefully.
This ability to edit the document may depend on your security access.
Doing this will allow you to "see" what properties of the document are setup to be editable by uses and which are not.