|
Dave
Many thanks for the reply. I suspected there wasn't a workaround but the strange thing is if I SaveAs from the File menu in Word then the problem does not occur.
Kind regards
Jim Munton
|
|
|
|
|
That's because an entirely new file is written, just like the temp file, but the original file is never deleted.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I developing a system and i want to create backup and recovery using vb.net and sql server 2000 as a database
|
|
|
|
|
Backup and Recovery of what?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am exporting a chunk of data in html present in a div tags to excel on the client side using some thing like following piece of code. It exports fine and it is working correctly.
The data in the div tags contain two tables inside it. The first table will give you the header information and the second table will give you the body of the data.
In the excel I want the data in the first table to be aligned to the center of the page which will be left aligned on the web page.So, i.e when I click the export to excel button I want the header information which is left aligned in the webpage must be aligned to center of the excel page. How can we do that? If you can post me a piece of code it will be of great help.
Thanks,
Raj.
<scriptlanguage="vbscript">
Sub exportbutton_onclick
Dim sHTML, oExcel, oBook
sHTML = document.all.item("DataGrid1").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub </script>
|
|
|
|
|
Can some body answer my question please! thanks
|
|
|
|
|
In my VB solution I need to write to a MS word file the data & graphic, therefore I need to add the VBIDE.dll in the Project Add Reference/COM.
However, when I try to search in COM list for the VBIDE ... I could not find it, except I only find the Microsoft Word 9.0 Object Library! This alone can not help me.
Anyone know how to add reference for VBIDE?
Thanks for any help
|
|
|
|
|
That's the Visual Basic Integrated Development Evironment. Why do you need it to modify a Word document?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My datagrid displays data from an Access table. The table has 10 records yet the datagrid displays 11 rows - the 11th row being blank. How can I keep from displaying this row?
Thanks in advance for any help.
|
|
|
|
|
This allows you to add new rows to the data. You'll have to set the AllowNew property[^] of the DataView, that your DataGrid.DataSource property is bound to, to False to turn this off.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What if the DataGrid.DataSource property is a DataSet instead of a DataView - how do you set the AllowNew property?
|
|
|
|
|
Look at the example in the link I gave you. It shows you how to create a new DataView object to bind your DataGrid.DataSource to.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Can someone try and import this XML into a Dataset, or is this XML no good?
<?xml version="1.0" standalone="yes" ?>
- <DATAPACKET Version="2.0">
- <METADATA>
- <FIELDS>
- <FIELD attrname="MESSAGELOGID" fieldtype="i4" required="true">
<PARAM Name="ORIGIN" Value="MESSAGELOG.MESSAGELOGID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="DIRECTION" fieldtype="string" SUBTYPE="FixedChar" WIDTH="1">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.DIRECTION" Roundtrip="True" />
</FIELD>
- <FIELD attrname="MESSAGETEXT" fieldtype="string" WIDTH="400">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.MESSAGETEXT" Roundtrip="True" />
</FIELD>
- <FIELD attrname="MESSAGEDATETIME" fieldtype="dateTime" required="true">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.MESSAGEDATETIME" Roundtrip="True" />
</FIELD>
- <FIELD attrname="VEHICLEID" fieldtype="i4" required="true">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.VEHICLEID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="OWNERID" fieldtype="i4" required="true">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.OWNERID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="MESSAGETHREADID" fieldtype="i4">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.MESSAGETHREADID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="MESSAGETYPEID" fieldtype="i4">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.MESSAGETYPEID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="PRIORITY" fieldtype="i4">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.PRIORITY" Roundtrip="True" />
</FIELD>
- <FIELD attrname="RESPONSE" fieldtype="string" WIDTH="255">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.RESPONSE" Roundtrip="True" />
</FIELD>
- <FIELD attrname="RESPONSETIME" fieldtype="dateTime">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.RESPONSETIME" Roundtrip="True" />
</FIELD>
- <FIELD attrname="MDTACKNOWLEDGED" fieldtype="string" SUBTYPE="FixedChar" WIDTH="1">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.MDTACKNOWLEDGED" Roundtrip="True" />
</FIELD>
- <FIELD attrname="VEHICLEREF" fieldtype="string" WIDTH="20">
<PARAM Name="PROVFLAGS" Value="0" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="VEHICLE.VEHICLEREF" Roundtrip="True" />
</FIELD>
- <FIELD attrname="AVLID" fieldtype="string" WIDTH="20">
<PARAM Name="PROVFLAGS" Value="0" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="VEHICLE.AVLID" Roundtrip="True" />
</FIELD>
- <FIELD attrname="RECEIVEDDATETIME" fieldtype="dateTime">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True" />
<PARAM Name="ORIGIN" Value="MESSAGELOG.RECEIVEDDATETIME" Roundtrip="True" />
</FIELD>
</FIELDS>
<PARAMS />
</METADATA>
- <ROWDATA>
<ROW MESSAGELOGID="163958" DIRECTION="I" MESSAGETEXT="Break Off" MESSAGEDATETIME="20050824T03:10:06000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T03:11:59000" />
<ROW MESSAGELOGID="163959" DIRECTION="I" MESSAGETEXT="Driving On" MESSAGEDATETIME="20050824T03:10:12000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T03:12:07000" />
<ROW MESSAGELOGID="163964" DIRECTION="I" MESSAGETEXT="Driving Off" MESSAGEDATETIME="20050824T04:37:03000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T04:38:52000" />
<ROW MESSAGELOGID="163965" DIRECTION="I" MESSAGETEXT="PoA On" MESSAGEDATETIME="20050824T04:37:09000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T04:38:58000" />
<ROW MESSAGELOGID="163969" DIRECTION="I" MESSAGETEXT="PoA Off" MESSAGEDATETIME="20050824T04:50:58000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T04:52:50000" />
<ROW MESSAGELOGID="163970" DIRECTION="I" MESSAGETEXT="Driving On" MESSAGEDATETIME="20050824T04:51:04000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T04:52:57000" />
<ROW MESSAGELOGID="163983" DIRECTION="I" MESSAGETEXT="Driving Off" MESSAGEDATETIME="20050824T06:01:35000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T06:03:25000" />
<ROW MESSAGELOGID="163984" DIRECTION="I" MESSAGETEXT="Break On" MESSAGEDATETIME="20050824T06:01:41000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T06:03:31000" />
<ROW MESSAGELOGID="164001" DIRECTION="I" MESSAGETEXT="Break Off" MESSAGEDATETIME="20050824T07:01:11000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T07:03:03000" />
<ROW MESSAGELOGID="164002" DIRECTION="I" MESSAGETEXT="Driving On" MESSAGEDATETIME="20050824T07:01:17000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T07:03:12000" />
<ROW MESSAGELOGID="164079" DIRECTION="I" MESSAGETEXT="Driving Off" MESSAGEDATETIME="20050824T09:44:02000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T09:45:53000" />
<ROW MESSAGELOGID="164080" DIRECTION="I" MESSAGETEXT="Other Work Off" MESSAGEDATETIME="20050824T09:44:08000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T09:46:01000" />
<ROW MESSAGELOGID="164081" DIRECTION="I" MESSAGETEXT="Other Work On" MESSAGEDATETIME="20050824T09:44:14000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T09:46:08000" />
<ROW MESSAGELOGID="164083" DIRECTION="I" MESSAGETEXT="Other Work Off" MESSAGEDATETIME="20050824T09:48:45000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T09:50:40000" />
<ROW MESSAGELOGID="164084" DIRECTION="I" MESSAGETEXT="Break On" MESSAGEDATETIME="20050824T09:48:51000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T09:50:46000" />
<ROW MESSAGELOGID="164122" DIRECTION="I" MESSAGETEXT="Break Off" MESSAGEDATETIME="20050824T10:50:26000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T10:52:16000" />
<ROW MESSAGELOGID="164123" DIRECTION="I" MESSAGETEXT="Other Work On" MESSAGEDATETIME="20050824T10:50:32000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T10:52:22000" />
<ROW MESSAGELOGID="164128" DIRECTION="I" MESSAGETEXT="Other Work Off" MESSAGEDATETIME="20050824T10:52:27000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T10:54:23000" />
<ROW MESSAGELOGID="164129" DIRECTION="I" MESSAGETEXT="Driving On" MESSAGEDATETIME="20050824T10:52:33000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T10:54:29000" />
<ROW MESSAGELOGID="164157" DIRECTION="I" MESSAGETEXT="Driving Off" MESSAGEDATETIME="20050824T11:51:44000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T11:53:37000" />
<ROW MESSAGELOGID="164158" DIRECTION="I" MESSAGETEXT="PoA On" MESSAGEDATETIME="20050824T11:51:50000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T11:53:43000" />
<ROW MESSAGELOGID="164173" DIRECTION="I" MESSAGETEXT="PoA Off" MESSAGEDATETIME="20050824T12:11:34000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T12:13:48000" />
<ROW MESSAGELOGID="164174" DIRECTION="I" MESSAGETEXT="Break On" MESSAGEDATETIME="20050824T12:11:34000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T12:14:00000" />
<ROW MESSAGELOGID="164212" DIRECTION="I" MESSAGETEXT="PoA Off" MESSAGEDATETIME="20050824T13:05:21000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:08:18000" />
<ROW MESSAGELOGID="164213" DIRECTION="I" MESSAGETEXT="Other Work On" MESSAGEDATETIME="20050824T13:05:33000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:08:31000" />
<ROW MESSAGELOGID="164214" DIRECTION="I" MESSAGETEXT="Other Work Off" MESSAGEDATETIME="20050824T13:08:03000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:10:59000" />
<ROW MESSAGELOGID="164215" DIRECTION="I" MESSAGETEXT="PoA On" MESSAGEDATETIME="20050824T13:08:03000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:11:03000" />
<ROW MESSAGELOGID="164222" DIRECTION="I" MESSAGETEXT="Break Off" MESSAGEDATETIME="20050824T13:24:47000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:27:21000" />
<ROW MESSAGELOGID="164223" DIRECTION="I" MESSAGETEXT="PoA Off" MESSAGEDATETIME="20050824T13:24:53000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:27:27000" />
<ROW MESSAGELOGID="164224" DIRECTION="I" MESSAGETEXT="Other Work On" MESSAGEDATETIME="20050824T13:25:05000" VEHICLEID="1004" OWNERID="155" MESSAGETHREADID="0" VEHICLEREF="GN04VFE" AVLID="352884003354371" RECEIVEDDATETIME="20050824T13:27:39000" />
</ROWDATA>
</DATAPACKET>
|
|
|
|
|
How about running it through an XML Validator[^] yourself first.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Another question
In my datagrid would like to paint rows and cells in different color, to mark if changes have been made and so forth. I've made my own textboxcolumns but i'm not pleased with the result, partly because theese columns "overrides" the datagrid function to color up the rows when you click on the rowheader column. Language - vb.net. Tips, anyone???
Evertbylt
|
|
|
|
|
You might want to have a look at these[^] articles on the DataGrid for Windows Forms.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
I'm working with an application where it would be desirable to preserve several columns in a datagrid for comboboxes (for choosing and searching). I've tried to fix it but it doesn't seem to work. Do anyone have an idea how to do this?? I'm working in VB.NET.
nicek168
|
|
|
|
|
Hi
I have a form with 7 datagrids each with between 2 and 10 columns. These are bound to DataViews which are bound to DataTables. I use DataVeiw.RowFilters to display the required data. I dont want to display all the columns in the DataGrids. Below is code to set up the first two columns of the first datagrid - another 6 to go... Any ideas how I could loop through the columns of each table, and perhaps pass the function an array of the desired column widths (setting hidden columns' column width to 0) for each table?
Tks
Private Sub InitialiseDataGrids()
Dim TextCol As DataGridTextBoxColumn
Dim ts As DataGridTableStyle
ts = New DataGridTableStyle
ts.MappingName = dtBOMDetail.TableName.ToString
TextCol = New DataGridTextBoxColumn
'Table 1 Col 1
TextCol.MappingName = dtBOMDetail.Columns(0).ColumnName
TextCol.HeaderText = dtBOMDetail.Columns(0).ColumnName
TextCol.Width = 200
TextCol.NullText = "0"
ts.GridColumnStyles.Add(TextCol)
'Table 1 Col 2
TextCol = New DataGridTextBoxColumn
TextCol.MappingName = dtBOMDetail.Columns(1).ColumnName
TextCol.HeaderText = dtBOMDetail.Columns(1).ColumnName
TextCol.Width = 300 'Hidden Column
TextCol.NullText = "0"
ts.GridColumnStyles.Add(TextCol)
Me.dgPartsList.TableStyles.Add(ts)
And so on..... another 50 times!!!
|
|
|
|
|
hi,
i have a datagrid with some data, how can i read all the data from the grid, or read some specific data (eg column2, row 3) from the datagrid? coz i need to store them to database, thanz in advance!
elcheah
|
|
|
|
|
A DataGrid doesn't have any data to look at. You should be looking in the DataSource (property) that the DataGrid is using. This is usually a DataSet or DataTable object, which should be retrieved from a database anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello there
I have a desktop application using webservices at backend. the problem is when I upload the file of more then 100MB it says after some time that "Connection time out". I increased the IIS - webservice time out property but even now the error is coming. my idea is that it is coming due to connection time out property of desktop application.
any information or suggestion will be appreciated to remove the bug
|
|
|
|
|
Hi,
I'm trying to send a windows message from vb6 to a vb.net app. The problem is that I can recieve a message, but the string I send with it is not recieved correctly by the vb.net app. When I try to put it back into a string again I get garbage.
Here is some code from the sending app (vb6):
<code>Private Sub cmdSendData_Click()
Dim sString As String
Dim lHwnd As Long
Dim cds As COPYDATASTRUCT
Dim buf(1 To 255) As Byte
sString = Trim$(txtString)
If sString = "" Then Exit Sub
'
' Get the handle of the target application's visible window.
'
lHwnd = FindWindow(vbNullString, cWINDOW_TITLE)
'
' Copy the string into a byte array,
' converting it to ASCII. Assign lpData
' the address of the byte array.
'
Call CopyMemory(buf(1), ByVal sString, Len(sString))
With cds
.dwData = 3
.cbData = Len(sString) + 1
.lpData = VarPtr(buf(1))
End With
'
' Send the string.
'
Call SendMessage(lHwnd, WM_COPYDATA, Me.hwnd, cds)
End Sub</code>
And here is the recieving app(vb.net):
<code> Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = MainForm.WM_COPYDATA Then
Dim data As CopyData
Dim message As String
' get the data...
data = CType(m.GetLParam(GetType(CopyData)), CopyData)
message = Marshal.PtrToStringAuto(data.lpData, data.cbData \ Marshal.SystemDefaultCharSize)
' add the message
Messages.Items.Add(String.Format("{0}: {1}", DateTime.Now.ToShortTimeString(), message))
' let them know we processed the message...
m.Result = New IntPtr(1)
Else
MyBase.WndProc(m)
End If
End Sub
Private Const WM_COPYDATA As Integer = &H4A
<StructLayout(LayoutKind.Sequential)> _
Private Structure CopyData
Public dwData As IntPtr
Public cbData As Integer
Public lpData As IntPtr
End Structure</code>
If I send the same message from a vb.net app then everything works.
Can anyone tell me what I'm doing wrong?
Thanks!
|
|
|
|
|
ok fixed it!
changes (in the .net code):
[code]
'message = Marshal.PtrToStringAuto(data.lpData, data.cbData \ Marshal.SystemDefaultCharSize)
Dim B(255) As Byte
Marshal.Copy(data.lpData, B, 0, 255)
message = System.Text.Encoding.Default.GetString(B)
[/code]
|
|
|
|
|
In VB.NET that permission read and write file .XML.
In Visual Basic, Can I do similar VB.NET?
|
|
|
|