|
RageInTheMachine9532
|
|
|
|
|
The cells in Excel are by default set to General and Excel formats them based on what it thinks you have entered in the cell, in this case any number padded with leading zeroes will be reduced. You can change the format of the cell in code with:
MyExcel.MyWorksheet.Cells(1,1).Numberformat="@"
However, when I've done this it caused a strange display problem when the text was very long. Another way to force it to display as you type is to put an apostrophe "'" before the text. The apostrophe won't appear in the cell's display but will in the fx bar across the top.
There is an AutoSize column width method but the syntax escapes me for the moment. Whenever doing anything with Word or Excel, record a macro of you doing it manually. This can be found in Excel in Tools->Macro->Record Macro. It will show you the syntax of any command you have performed.
Hope this helps.
|
|
|
|
|
Hi there guys.
Have a little problem. I need to search through a Word doc, and highlight all occurrences of what we are calling "tagged fields". A tagged field is in the format <<sometext>> (eg. <<name>> or <<addr1>>
Am having a problem with getting word to find these fields. If I search for "^50^50" (<<), then it finds OK, ditto "^52^52"(>>), and if there is a single char between the tags, the ^50^50^$^52^52 works fine. Unfortunately, the text may be of different lengths. Aha - can use the * wildcard! Unfortunately not....when attempting ^50^50*^52^52, keeps telling me that invalid pattern match is being used, since need to explicitly use wildcard matching.
Any ideas anyone?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
S'ok - cracked it....just use an escape char '\', so to find my fields, I have used
\<\<*\>\>
with wildcards turned on.
Simple really!
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I've been trying to use the databinding directly to an ADO recordset. Everything works ok except if someone else changes a Record in the source, the DataCombo/list do not see the change. Same if a record is added or deleted. How would I program this to see any changes/Additions? My programs are all shared, using a Database on a server.
|
|
|
|
|
The database your using would have to support sending back notifications of changes so you could refresh your Dataset. SQL Server supports this as an additional install on the server, but Access doesn't.
RageInTheMachine9532
|
|
|
|
|
Thanks, I kinda thought that was the case. I was just trying Databinding as a different way of doing it. I've been doing the data accessing direct and coding my own interfacing. I can't do that very well in the .Net. Thanks a lot for the Info.
|
|
|
|
|
I am trying to figure out how to hook this DocumentBeforeSave event when using IDTExtensibility2( Add-in
for all office application )got this idea from ms knowledge base Q238228
I worked with "Using the VB6 Add-in Designer", but not with "COM Add-In Using Implements"
Dim WithEvents objWord As Word.Application
Private Sub objWord_DocumentBeforeSave(ByVal Doc As Word.Document, SaveAsUI As Boolean, Cancel As Boolean)
msgbox "please say something!!!"
End Sub
Thanks in advance
Shin
|
|
|
|
|
|
I am aware of System.IO.Path.InvalidPathChars. However, I don't know how to filter out these characters when input into a text control. I tried using the TextBox1.KeyDown event, but I don't know how to keep the invalid char from showing up in the textbox, even if I can identify it.
Mark Kettlewell
|
|
|
|
|
Hi,
I am stuck when try to detect an user deleting a row of a datagrid table! I do need to perform some tasks at that moment, but so far I can't!
*) I did try to set datagrid events KeyPress, KeyDown, KeyUp but somehow no event generated when I success delete a datagrid row!
Can someone explain or show me how to set this kind of event?
Thank for any help!
|
|
|
|
|
Just get an event on the form and see there is a change on the number of rows in the datagrid. Work?
Shin
|
|
|
|
|
Hi Shinay,
This way is worked, except that I have to do two steps.
Thanks
|
|
|
|
|
I am receiving this error when trying to open an oledb connection on an Excel file from within VB.NET. All samples I have seen seem straight forward but for some reason I cannot connect to the file. My Connection string is "Provider=Microsoft.Jet.Oledb.4.0;Datasource=c:\file.xls;Extended Properties=Excel 8.0;HDR=Yes".
I have attempted to manipulate my connection string with different properties with no luck. If anyone has any suggestions as to what is wrong please let me know.
|
|
|
|
|
I have a dialog with a treeview and a listview. I want the listview to change when i select a different node on the treeview (I use the AfterSelect event of the treeview) - before I show the dialog using dlg.ShowDialog() I want to populate the treeview and then in the code select the a treeview node to fire the AfterSelect event which will populate the listview then I want to programatically select some items in the listview.
The problem is that the AfterSelect event doesn't seem to get fired until the dlg is shown so if I do
<br />
call dlg.PopulateTreeView()<br />
call dlg.SelectListViewItems()<br />
dlg.ShowDialog()<br />
the listview isn't populated when I call dlg.SelectListViewItems
Is there a well known way of doing this?
Rugby League: The Greatest Game Of All.
|
|
|
|
|
You might want to try calling Application.DoEvents() before you call the dlg.ShowDialog(). It's no so much of a problem of when the event gets fired, but when it can get processed.
RageInTheMachine9532
|
|
|
|
|
I already tried that, it didn't make a difference.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
OK. After going back and re-reading the original post, I misunderstood you.
Calling the Select methods in the ListView and TreeViews will NOT fire the AfterSelect events). They will only fire on mouse clicks. But, you can call those functions from another form's code if those functions are marked public. A better method would be to have your event handlers call these functions seperatly so you can make the functions public and not the eventhandlers:
The following is not useable code. It is a pseudo-code example for illustration purposes only!
Form1:
Dim dlg As New Dialog1
dlg.PopulateTreeView()
dlg.AfterSelectHandlerFunction()
dlg.ShowDialog()
Dialog1:
Private Sub TreeView_AfterSelect([eventargs stuff]) Handles TreeView.AfterSelect
AfterSelectHandlerFunction()
End Sub
Public Sub AfterSelectHandlerFunction()
[code to do whatever here]
End Sub
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When you create a toolbar in any .NET application, (I'm working in VB.net but I had the same problem in C#.net) and set the background image to whatever image you want, if the toolbar appearance is "flat" the background image takes over the toolbar and instead of the toolbar being gray, it's like the background image was also tiled on the toolbar
anyone ever seen this? There's no code involved to reproduce this problem, all you need is a toolbar with the appearance set to flat, and a background image
|
|
|
|
|
I have a question. How do I programmaticly open the System Properties dialog just like the user right clicked My Computer and selected Properties. I am using VB6. Any help would be GREATLY appreciated!
The Dragon
|
|
|
|
|
Ooops....found it. Here it is if anyone else is looking for it: link
The Dragon
|
|
|
|
|
Dear Expert,
I'm a mschart control newbie. Here are 3 Questions needed your help.
(below is supposing to use this contorl in VB , you can also use it in VC, or other windows program tools capable of using this ActiveX controls, the encountered problem is same)
Q1: When I set *.ChartType=VtChChartType2dXY, How can I set X-asis Label to
my own expected string instead of Xas automatic generated by
itself.(Such as datetime instead of "0 1 2 3 ...")
Q2: Both when *.ChartType=VtChChartType2dXY or VtChChartType2dLine,
and when Xas Lable string is too long , How can I display it in Multi-line
Q3: When *.ChartType=VtChChartType2dLine , and after I set xasis.tick.style=...Inside,
& xasis.tick.length=200, it does not take effect, nothing changes , and what I expected to occur does not occur
In sum, What I want to do is by using mschart (must , cant use any other 3rd party controls),
set xasis infos(such as label , tick style, length) customarily by my expected format
Thanks in advance , Expecting your answer!
Allen, Homer
|
|
|
|
|
Hi everybody,
i'm making a addin for outlook 2k3, it works fine but i can't add commandbarbutton in Standard commandbar.
Can you help me ?
this is my code source :
Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete
Dim oType As Type
Dim oArgs As Object()
Dim objMissing As Object = Missing.Value
'TODO: Connecter une nouvelle barre d'outils
' Ajout du bouton dans la barre standard
Try
oType = applicationObject.GetType
objCommandBars = oType.InvokeMember("CommandBars", BindingFlags.GetProperty, Nothing, applicationObject, Nothing)
stdCommandBar = objCommandBars.Item("Standard")
btnFortune = stdCommandBar.FindControl(MsoControlType.msoControlButton, objMissing, , "Fortune", True)
If (btnFortune Is Nothing) Then
btnFortune = stdCommandBar.Controls.Add(MsoControlType.msoControlButton, objMissing, objMissing, objMissing, objMissing)
btnFortune.Caption = "Fortune"
btnFortune.Style = MsoButtonStyle.msoButtonCaption
btnFortune.Tag = "Fortune"
btnFortune.Visible = True
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message, ex.Source)
End Try
End Sub
At run, I take a "Unknown name" error (french message : "Nom Inconnu") on line "objCommandBars = oType.InvokeMember("CommandBars", BindingFlags.GetProperty, Nothing, applicationObject, Nothing)"
Thanks for your help.
Seb.
Sébastien FERRAND
|
|
|
|
|
If I have a DB on one machine in a network and I connect to it from an app on another machine, how do I supply the username and password for the PC with the DB on it. Is it done through the connection string or is there another way to get the client to pre-log on before attempting to make a connection to the DB.
Greg
|
|
|
|
|
Normally, you'd supply that information in the connection string. Is this an SQL Server? If so, then all you need is the SQL username and password in the connection string. I would avoid using Windows authentication or trusted connections if at all possible. Using an SQL login is more secure because this ID won't have access to the underlying server.
But if it's an Access database, then you'll have to authenticate to the machine before you can even attempt to get to the Access database. On the side, Access databases we're not designed for connections from other machines. It will work, but performance stinks and the number of connections you can get is, normally, very limited.
RageInTheMachine9532
|
|
|
|