|
This is the code to serialize an object (that is serializable)
Public Function sSerializeObject(ByVal oObject As Object) As String
Dim oSerializer As New XmlSerializer(oObject.GetType)
Dim oSR As New MemoryStream, bt() As Byte
Try
oSerializer.Serialize(oSR, oObject)
bt = oSR.GetBuffer
sSerializeObject= System.Text.Encoding.ASCII.GetString(bt)
oSR.Close()
oSR = Nothing
oSerializer = Nothing
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
|
|
|
|
|
Ok, but you say "This is the code to serialize an object (that is serializable)".
My object is a XmlDocument, and it doesn't implements the serializable interface.
So, is the better way pass as byref parameter a string (or a stream) and then parse it with "loadXml" method ?
|
|
|
|
|
If your using .net remoting like I know it, then BYREF is questionable. I don't think that's possible -- you may know more about that...
You can convert the xmldocument a string, pass it over to your server pc via tcp connection(stream) and then do a loadxml on the server and process it, then pass back the changes and then replace your document with the one the server returned...
|
|
|
|
|
I want to develop a software directory like the one you see in Snapfiles
I am just confused how i should design the database for that.
It has 2 levels of hierarchy. The first level there is Browser Tool, Communication,...
The second level is Bookmark Manager, Chat(IRC),Font Tools
(^^^ these r from the site)
I think i have create 3 tables for that. One for the first level, 2nd for the second level & the 3rd for the software listings.
I am going to use VB.net for front end. Not sure if i should access or sql server as the back end.
I just want the opinion as i am newbie & inexperienced.
If i am asking in the wrong place, pls guide me to the right place or atleats tell me how i can find the right place
|
|
|
|
|
Can anyone tell me if vb2005 has a function comparable to InvokeVerbEx("Print")?
I have a folder that contains a number of .pdf files. I would like to have my code print each one of the .pdf files. If I right click on the file and click 'print', acrobat opens, prints the file, and then closes the file. Acrobat stays open, which is fine. I just want to send the files to the printer.
Thanks in advance.
|
|
|
|
|
Search for hours....no success.
Post a question...find it in 10 minutes. Go figure.
Here is what I found in case anyone cares.
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.htm"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
|
|
|
|
|
Hello, i have recently developed an application using the Windows Media Player ActiveX/SDK
I want to be able to load plugins available in Windows Media Player in my application, such as the Windows Live/MSN Messenger Status plugin, so when somebody listens to a music track in my application it would trigger the plugin to activate and work like it was in WMP.
I'm sure there is a simple procedure, but maybe i am overlooking it...
Please help
Thanks
|
|
|
|
|
I have two functions created, one that creates a zip folder which contains files and one that creates a backup folder. I need to know how to copy that zip folder to the backup folder.
Thanks!
jds1207
|
|
|
|
|
JDS,
Dim oDir As DirectoryInfo,sZipPath as string,sBackupPath As String
sZipPath="c:\zip\"
sBackuppath="C:\backup\"
oDir = New DirectoryInfo(sZipPath)
For Each oFile As FileInfo In oDir.GetFiles
File.Copy(oFile.FullName, sBackuppath & oFile.Name, True)
Next
'copies all files from the zip directory to the backup directory and replaces if alread there...
Hope this helps
nathan
|
|
|
|
|
Here are my two functions that I call under button click:
Public Function CreateZip(ByVal source As String, ByVal destination As String) As Boolean
If (Not (File.Exists(source))) Then
Return False
End If
If (Not (Directory.Exists(destination))) Then
Return False
End If
Try
Dim fastZip As FastZip = New FastZip
fastZip.CreateZip(destination, source, True, "", "")
Catch
Return False
End Try
Return True
End Function
Public Sub Folder()
Dim dirName As String = DateTime.Now.ToString("MM_dd_yyyy hh.mm.ss")
Dim fullPath As String = Path.Combine("C:\Data Feeds\Backup\", dirName
If (Not (Directory.Exists(fullPath))) Then
Directory.CreateDirectory(fullPath)
ElseIf (Directory.Exists(fullPath)) Then
Directory.CreateDirectory(fullPath(2))
End If
End Sub
I want to know how to copy the destination folder to the fullPath folder when it is created.
jds
|
|
|
|
|
Jds,
there doesn't seem to be a vb.net way that doesn't involve enumerating through all the folders and files. I can give you that code if you want it.
the quick way would be to do the following...
Dim fso As Object
fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFolder("C:\test", "c:\temp\")
fso = Nothing
copies the folder "test" into c:\temp\ resulting in c:\temp\test\
|
|
|
|
|
I got the following error: Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)which highlighted this line of code: fso.CopyFolder("C:\test.zip", "C:\Data Feeds\Backup\").
Any ideas?
jds
|
|
|
|
|
jds,
it looks like your trying to treat the file as a folder. the method copyfolder will only work with 2 folders (source/destination). your trying to make the zip file a folder (seemingly).
file.copy("c:\test.zip","C:\Data Feeds\Backup\test.zip",true) '<--should take care of the copying.
sorry-->my understanding is that you were trying to copy 1 directory and all it's subfolders into another.
nathan
|
|
|
|
|
Sorry,
I am trying to copy 1 directory and all it's subfolders into another. I already have the zip folder created with its folders and subfolders through code and I have the code to create a dated folder in another procedure which will be the backup folder. Once I click the button to create the zip folder I want the backup folder to be created containing that zippped folder.
Thanks!
jds
|
|
|
|
|
I maybe way off but you seem to have the answer in your code that you gave. pass in the variable "fullPath" into your function that creates the zip as the destination
Dim dirName As String = DateTime.Now.ToString("MM_dd_yyyy hh.mm.ss")
Dim fullPath As String = Path.Combine("C:\Data Feeds\Backup\", dirName)
Dim fastZip As FastZip = New FastZip
fastZip.CreateZip(fullPath, source, True, "", "")
won't the create a zip of whatever the source is into fullpath?
|
|
|
|
|
No, that doesn't work. The "test.zip" folder is already located in c:\. Remember, these are two different sub procedures. I want that test.zip folder to be copied to the dated folder which I create with the code below as a backup:
Public Sub BackupFolder()
Dim dirName As String = DateTime.Now.ToString("MM_dd_yyyy hh.mm.ss")
Dim fullPath As String = Path.Combine("C:\Data Feeds\Backup\", dirName)
If (Not (Directory.Exists(fullPath))) Then
Directory.CreateDirectory(fullPath)
ElseIf (Directory.Exists(fullPath)) Then
Directory.CreateDirectory(fullPath(2))
End If
End Sub
Hope I explained this accuratley.
jds
|
|
|
|
|
I think theres some confusion going on. Test.Zip is not a folder. You can't navigate through it and treat it like a folder in your code. It MUST be treated as a file. The only reason you can do so in Explorer is because there is a Shell extension giving you the illusion of a navigable file system in the ZIP file.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
pls can someone direct me how to connect to access database using VB.Net
john
|
|
|
|
|
This[^] should be all you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello Everyone.
I hope someone can help me with this problem. i have a datatable bound to a bindingsource, and i display its content through a datagridview in this way:
bindingSource1.DataSource = dataTable1
dataGridView1.DataSource = bindingSource1
My problem is that when i update the data contained in the table through the bindingsource, my datagridview does not refresh and keeps displaying the old values. but the strangest thing is that if i manually sort the datagridview by clicking a column header, the datagrid refreshes and displays the updated values. this occurs only if i manually click on the headers, it does not work if i sort the grid in the code or if i call datagridview1.refresh()
I desperately need the datagrid to update its values as i update the bindingsource, without clicking anything. how can i do that?
Thanks in Advance,
Rey9999
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
Have you tried calling Control.Invalidate(), then calling Control.Update() ?
The sequence of these two method calls should force the DataGridView to redraw itself.
|
|
|
|
|
Sebrell wrote: Have you tried calling Control.Invalidate(), then calling Control.Update() ?
The sequence of these two method calls should force the DataGridView to redraw itself.
i tried but i still have the same problem...
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
so much for the simple answer...
I'm reminded of a similar problem I once had with a RichTextBox, where I needed to force it to redraw its scroll-bars. I solved that problem by writing a method along the lines of the following:
(C# code, sorry)
private void Jiggle() {
if (this.Orientation == Orientation.Horizontal) {
this.rtfBox.Width -= 3;
this.rtfBox.Width += 3;
} else {
this.rtfBox.Height -= 3;
this.rtfBox.Height += 3;
}
this.rtfBox.Invalidate();
}
I then called this method from the method that needed to redraw the RichTextBox (which was a property setter for a container control). I was surprised how well it worked. Especially since the RichTextBox in question had its Dock property set to DockStyle.Fill.
I'd suggest dynamically changing, by a small number of pixels (fewer than 8), the Width of one of the ColumnHeaders in your DataGridView, since it works when you click it. Or to change the Sort column to a different column, then back to the original column.
HTH
Sebrell
-- modified at 14:30 Wednesday 18th October, 2006
|
|
|
|
|
i'll try, thanks
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
I found the solution by chance... i realized i was updating the bindingsource's datasource instead of the bindingsource itself. may i be cursed eternally for my mistake
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|