|
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....
|
|
|
|
|
Rohit Dev wrote: how can i convert an array of bytes into an array of string in classic VB?
I take it you're talking about VB6. You can find examples all over the web, like this one[^].
Rohit Dev wrote: How can i use Peek and Poke in Classic VB?
Peek and Poke don't exist in VB6. They also don't have any meaning under Windows since each process runs in it's own memory space, as if it was the only process running in the system.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi again,
I get the following error
"Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated."
Below is the code where I get this error.
Private Sub txtTextField_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRoomNo.KeyPress
'A number, backspace and dot allowed only
If Not (e.KeyChar.IsNumber(e.KeyChar)) And Not (e.KeyChar.IsControl(e.KeyChar)) Then
e.Handled = True
End If
End Sub
Any ideas where I am going wrong or how to fix this problem?
|
|
|
|
|
hi dear,
first of all please be sure you handeled keypress event for Correct text box. Code provided by you shows that it handles keypress event of txtRoomNo , not of txtTextField.
use following code for allow a number, backspace and dot only
If Not (Char.IsControl(e.KeyChar)Or Char.IsNumber(e.KeyChar)Or e.KeyChar = ".") Then
e.Handled = True
End If
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
|
dear friends
I have made setup n deployment project. I want is that when the location is selected for the application the location must be saved to the registry eg. "C:\Program File\new software". so how should i achive this.
please help me out.
thanxs in advance
Taher
|
|
|
|
|
Do you need this value in your code somewhere? If so, it's easy enough to get at runtime without going to the registry to get it. This path is returned by Application.StartupPath .
Dim myAppPath As String = Application.StartupPath
If you wanted to write this value to the registry during the installation, you'd have to create a custom action to do it. You can find out more about custom actions here[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|