|
I have two arrays. The first holds titles, the second holds text to see if the titles should be in a different case or bold. These names are then displayed in a Combo Box. Please bear with my simple example but it is about the only way to discribe what I want to do.
vNames = Array("Smith", "Hudson", "Jones")
VString = Array("H","I","h","i")
So I want to search the above vNames array for the vString, and if so I need it to be set to bold
This is what I was thinking:
For i = 0 To 2
For j = 0 To 1
If InStr(vNames(i), vString(j)) <> 0 Then
cmbName.FontBold = True
End If
Next j
Next i
But when I do this all three names are in bold, when my thinking is just the first two names should be bold.
Thanks in advance for any advice,
Dan
|
|
|
|
|
I'm assuming you're using VB6. This won't work because the FontBold property of the ComboBox is for all of the items in the ComboBox, not ones you pick. It's either all of the items are bolded, or none of them.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I am actually using vba for Word 2003, which I believe is much closer to VB6 than to anything else.
And you are right about it doing the whole list. One the name is picked it is added to a Word document text form field, what I believe I will need to do is this: set my txtName.Value, test for the string, then bold if need be.
Thanks for the reply.
Dan
|
|
|
|
|
The reason why they are all bold is because you are changing the combobox font to bold not the individual entry to bold.
|
|
|
|
|
Thanks for pointing this out. I think I have found a way to handle this with the selected value, not the combo box.
Dan
|
|
|
|
|
Hi guys
A little background info:
I receive XML files with the same data in different formats. The data from these XML files has to be stored in 3 different SQL tables.
What I am trying to do is write a generic code in VB.net that will read these XML files and may be based on some schema definition populate the XML data in the 3 different tables.
I have written code that does not refer any schema definitions and is good only for one XML format any ideas on how to write generic code to do so??
Any help would be appreciated.
Thank you in advance
Ziaous
|
|
|
|
|
I am not sure on the specifics of your problem, but depending on how the xml data is written, you could read it into a dataset using the schema.
<br />
<br />
dim data as new dataset()<br />
data.readXmlSchema("Schemafilename")<br />
data.readXml("xmlfilename")<br />
<br />
and the data will now be in (a) table(s) in that dataset, like I said this will not work for a lot of xml data, but it is a start.
|
|
|
|
|
Hi Kevin
I have no issues loading or paring an XML file, what I am trying to do is depending on the given xml schema definition or DTD the code should be capable to load the XML table in the appropriate table.
Right now I read an XML file in VB.Net pass it to SQL code and there I have hard coded attribute paths that help me select data from XML file and insert into the table, like:
Insert Into StoreInfo(StoreNumber,StoreName)
SELECT distinct StoreNumber,StoreName
FROM OPENXML (@XmlDocId, '/Root/Data/StoreInfo',1)
Now, instead of using this method I want the code to read XML file as well as a schema def. and create a dynamic insert query that I can pass to the database...
I hope that makes sense.
Thanks
|
|
|
|
|
If you are using SQL-Server then you may be able to use Microsoft's SQLXML component to do this less painfully.
|
|
|
|
|
|
I have a vb.net application in which i have an add-in in the powerpoint. Now when i insert a new slide and right click on the "click to add title" or "click to add subtitle" i get a context menu pop up. I want to add my own menu items to this pop up. Can anyone suggest me how to do tht. I will be writing the code to add the menu items in the right click event of the pptapplication i.e
Private Sub pptApplication_WindowBeforeRightClick(ByVal Sel As Microsoft.Office.Interop.PowerPoint.Selection, ByRef Cancel As Boolean) Handles pptApplication.WindowBeforeRightClick
End sub
I dont want to create a new context menu. I want to add the items to the existing context menu. someone pls help
chakor
|
|
|
|
|
So many times a day are you going to ask this question?? The more you do this, the more you will most likely get ignored.
It takes to research some of this stuff, especially doing Office Interop. The base of developers doing work in Office is very small, so it's not real likely that your post will get answered unless you go to a forum that specializes in it, like this one[^] on MSDN.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I have a .NET (2.0) application that is on a shared network. I have used caspol (Microsoft .NET Framework 2.0 Configuration) to grant FullTrust permission to the application. When I execute the application on Windows XP it works fine. If I run in on Vista I get the following error:
The description for Event ID 1000 from source Application Error cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
EMS.exe
34.0.131.0
463909e3
KERNEL32.dll
6.0.6000.16386
4549d328
e0434f4d
00000000000233ac
The substitution string for insert index (%1) could not be found
After stepping through the code and creating a test windows app I found that this line is causing problems:
AddHandler Application.ThreadException, AddressOf eh.OnThreadException
What is Vista doing differently and why would this line cause my application to fail?
Here's the full code for a simple windows app that will fail:
Imports System.Threading
Public Class Main
Public Shared Sub Main()
Application.EnableVisualStyles()
Dim eh As New CustomExceptionHandler
AddHandler Application.ThreadException, AddressOf eh.OnThreadException 'If you remove this line the app will run on Vista
Dim frm As New Form1
frm.ShowDialog()
End Sub
Private Class CustomExceptionHandler 'To Handle Application.ThreadExceptions
Public Sub OnThreadException(ByVal sender As Object, ByVal t As ThreadExceptionEventArgs)
ErrorHandler(t.Exception)
End Sub
End Class
Public Shared Sub ErrorHandler(ByVal ex As Exception)
'Error Handler code here
End Sub
End Class
Thanks,
Sean
|
|
|
|
|
First, it looks like you're assuming that this exception handler will handle any exception that is thrown by your app. This is not the case. The documentation on ThreadException is a bit confusing, but it throw this exception during the processing of window messages, and only AFTER the first form is created. It won't catch every possible exception that isn't already handled.
I think it crashed because you didn't use Application.Run to start a message pump to show the startup form.
I don't have a dev environment setup on Vista, so I can't test anything. I think you have to change this, which , BTW will LEAK RESOURCES because, since you displayed the form using ShowDialog() , you're not disposing of the form when you're done with it. This is not necessary if you display the new form using Show() instead:
Dim frm As New Form1
frm.ShowDialog()
To this:
Application.Run(new Form1())
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for the reply. I'll check my code to make sure the ThreadException is working.
However, I changed my code to this below and I still get the error:
Imports System.Threading
Public Class Main
Public Shared Sub Main()
Dim eh As New CustomExceptionHandler
AddHandler Application.ThreadException, AddressOf eh.OnThreadException 'If you remove this line the app will run on Vista
End Sub
Private Class CustomExceptionHandler 'To Handle Application.ThreadExceptions
Public Sub OnThreadException(ByVal sender As Object, ByVal t As ThreadExceptionEventArgs)
ErrorHandler(t.Exception)
End Sub
End Class
Public Shared Sub ErrorHandler(ByVal ex As Exception)
'Error Handler code here
End Sub
End Class
This doesn't even open a form and it's crashing on Vista.
Any ideas?
|
|
|
|
|
No idea. Like I said, I don't have anything to test it on.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
First post I think so be nice! I have created a dll file using the systems.collections.generic namespace. I have built the dll file in V Studio 2005. I can now reference the dll from 2005 but not V Studio 2003. V Studio 2003 states the dll is invalid (me thinks poor backward compat from MS!) I know the generics was intoduced in .net 2.0 and is not available in any previous framework. I cannot upgrade out applications to 2005 at present as there are too many in the site. I know little about the application pools, is this the only way to get round the problem? Any suggestions as to how I can create a generic class to house a collection in 2003 would be greatly appreciated.
Kindest Regards
TSB
TonySmithBrewster
|
|
|
|
|
|
tonysmithbrewster wrote: V Studio 2003 states the dll is invalid (me thinks poor backward compat from MS!)
No, the .DLL IS valid and backwards compatibility isn't the problem here. The problem is that you cannot load two different versions of the .NET Framework runtime into the same process at the same time, which is what you're trying to do.
You have to write your 2003 code in 2005 in order to use Generics at all. The .NET 1.1 CLR doesn't support Generics, no matter how you write it in 2005.
tonysmithbrewster wrote: I cannot upgrade out applications to 2005 at present as there are too many in the site.
The other problem you have is that you can't run two version of ASP.NET on the same IIS instance at the same time. You'll have to run two different instances, and two different applications(!) in order to get this to work. You CAN have ASP.NET 1.1 pages link to ASP.NET 2.0 pages. You just can't have both ASP.NET 1.1 and 2.0 running under the same IIS instance at the same time.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
i want to send and receive xml packets to/from a server running EPP system at some port It accepts well formed requests and returns the response in a wellformed xml packet
Please guide how to create , send , receive and read the received packet ???
|
|
|
|
|
XML isn't a transport protocol, so "packet" doesn't have any meaning in XML.
You can find a bit more information on connecting to an EPP server here[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi! All,
I want my application to terminate automatically at desired time(VB 6.0). Please help me.
Thanks and Regards,
Virendra
|
|
|
|
|
Have a timer and check the time for each event
and use Exit to end the application.
Regards,
Arun Kumar.A
|
|
|
|
|
Setup a Timer in your startup form, set it for a 60 second interval. Check the current time against your scheduled time and if they match, stop the timer and call End or Unload startupFormName .
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi all,
how can i convert an array of bytes into an array of string in classic VB?
How can i use Peek and Poke in Classic VB?
Thanks in advance....
|
|
|
|