|
Well, Word itself can save the document to XML (WordML). I would guess that this would be your starting point.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hello
the convertion should be done in C# with XML
thanks
etretyertyery
|
|
|
|
|
Yes - but you can use Word via Interop, so you can do this like that.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
can u give me some example with some snapshot
10x.
regards
etretyertyery
|
|
|
|
|
Hi All,
I have a windows application that was developed in .NET 1.1 Framework.
Recently I migrated the same application into .NET 2.0 Framework to find a number of cross thread operation exceptions being thrown.
After some research, I found that Anonymous methods and delegates could solve the issue. Hence, I implemented the same and the application was working fine except a case when the call to the delegate using 'Invoke' causes the application to hang.
Use of 'BeginInvoke' instead of 'Invoke' also didnt help me.
Anyone faced a similar situation and found a solution? Plz help.
Thanks in advance,
Murali
|
|
|
|
|
Hi
This is to print a form which contains a tab control.For this you have to instal Microsoft.Visual Basic.PowerPacks.Printing.dll.Then add one command button and a tab control to your form.Then add some other controls to your tabpages.Drag PrintDocument1 control from the tool box to your form.After that paste the code in the code behind.Press F5 to run it.Click on the button1 to print the pages.
Option Strict Off
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Runtime.InteropServices
Public Class Form1
Dim TabId As Integer
Dim i As Integer
Dim img As Bitmap
Dim WithEvents pd As PrintDocument
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.TabControl1.SelectTab(0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
TabId = Me.TabControl1.TabCount
For i = 0 To TabId - 1
Me.TabControl1.TabIndex = i
Me.TabControl1.SelectTab(i)
'MsgBox(i)
Me.Refresh()
img = CaptureForm1()
pd = New PrintDocument
pd.Print()
Next
Catch ex As Exception
MsgBox(ex)
End Try
End Sub
Function CaptureForm1() As Bitmap
Dim g1 As Graphics = Me.CreateGraphics()
Dim MyImage = New Bitmap(Me.ClientRectangle.Width, (Me.ClientRectangle.Height), g1)
Dim g2 As Graphics = Graphics.FromImage(MyImage)
Dim dc1 As IntPtr = g1.GetHdc()
Dim dc2 As IntPtr = g2.GetHdc()
BitBlt(dc2, 0, 0, Me.ClientRectangle.Width, (Me.ClientRectangle.Height), dc1, 0, 0, 13369376)
g1.ReleaseHdc(dc1)
g2.ReleaseHdc(dc2)
'saves image to c drive just, u can comment it also
MyImage.Save("c:\abc.bmp")
Return MyImage
End Function
Sub pd_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) Handles pd.PrintPage
Dim x As Integer = e.MarginBounds.X
Dim y As Integer = e.MarginBounds.Y
e.Graphics.DrawImage(img, x, y)
e.HasMorePages = False
End Sub
<dllimport("gdi32.dll", entrypoint:="BitBlt" ,="" _
setlasterror:="True," charset:="CharSet.Unicode," _
exactspelling:="True," _
callingconvention:="CallingConvention.StdCall)"> _
Private Shared Function BitBlt(ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean
' Leave function empty - DLLImport attribute forwards calls to MoveFile to
' MoveFileW in KERNEL32.DLL.
End Function
Hope this may b helpful for you sometimes.
Thanks
Vinidimple
dimp
|
|
|
|
|
hi,
how to use a flash file in windows application?"
i want to insert a clock in my application which will show the system timing.
plz help
p.sethi
|
|
|
|
|
I've never heard of embedding flash files directly, however, you can add a web browser control and navigate it to an html file with the embedded flash file.
|
|
|
|
|
Search google for an application that will convert flash files to XAML. You can then use WPF of .NET 3.0 if you have it to use the new XAML file.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Until recently I have been keeping Data layer objects and task logic as seperate from the UI logic as possible. I have been experimenting with custom user controls and attempting to integrate the custom datalayers with the designer by modifying the InitializeComponent method. I have been successful in integrating my data layer data into the designer, however, it doesn't like to stay. Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
|
|
|
|
|
SlingBlade wrote: Are there any easy workarounds to this such as a way to tell the designer not to modify a peace of code in the InitializeComponent method?
InitializeComponent is the designers method. You cannot change it because the designer will overwrite your changes. In VS2005 it has been moved out to a separate file which you should not be editing either.
SlingBlade wrote: I have been successful in integrating my data layer data into the designer
The data layer should be no where near the designer. What ever it is that you have done, it isn't separate the data layer from the presentation layer. The data layer and presentation layer should not meet at all. There should be a business layer in between.
|
|
|
|
|
I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported. Data, business and presentation is how I have always done it, but like I mentioned I am getting into developing custom controls that make the presentation layer much simpler and well defined to what need be accomplished, that and Microsoft offers the ability to define your entire data layer within the presentation layer. The data layer is still seperated with a business layer. I am really looking for a way to bring the schema into the designer so my custom controls can be assigned to the proper datatables that are returned in a data layer method without manually creating the schema for every table within the local Dataset for the control.
|
|
|
|
|
SlingBlade wrote: I'm going to agree to disagree here. I'm pretty sure it is a lost cause trying to get support for something that is clearly defined as unsupported.
I'm not entirely sure what you are disagreeing with. I'm suggesting that you cannot change the code in the InitializeComponent method because it is unsupported as Visual Studio will overwrite any changes you make. Then you say you disagree with me because it is a "lost cause trying to get support for something that is clearly defined as unsupported".
SlingBlade wrote: that and Microsoft offers the ability to define your entire data layer within the presentation layer.
Just because you can do something, doesn't mean you should do something. I can walk up a set of railway tracks. However, doing so is clearly inadvised.
|
|
|
|
|
I was refering to Microsoft not providing a way to manually interact with the designer. People come up with new design patterns all the time and I particularly considered what I was trying to accomplish as an innovative compromise to keeping the data layer seperate from the presentation layer but still be able to define how the presentation layer interacts with the data layer more clearly. Sorry for the run on sentence.
What I'm trying to get at here is that I am using VS Express and am not currently at liberty to make feature requests directly. Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround. Since when has Microsoft been about following all standards exactly?
|
|
|
|
|
SlingBlade wrote: Sure modifying InitializeComponent is a bit dangerous, but, it's my machine I'm crashing and it sounds like Microsoft is just being lazy with it's almost limitless supply of resources to not provide a workaround.
It occurs to me that since InitialiseComponent is called from the constructor, why not create your own method and call it from the constructor too?
|
|
|
|
|
That works fine at run time, but does not show up in the designer, even if you do the work before the InitializeComponent call in the constructor. I am thinking I am just going to have to manually define the table schemas in the dataset and have them filled at run time for the clarity I am going for. It is a bit more work and debugging but those are the breaks I guess.
Thanks for helping keep me from going too far off on a tangent. It's kind of weird to mention this but even my horoscope that just hit my hotmail is in agreement with you.
"Impose a looser, more go-with-the-flow kind of structure on your work habits, and you just might accomplish even more than you hoped. The payoffs may not be immediate, but they'll greatly benefit your future."
|
|
|
|
|
Hi, I am working on a .net c# windows application in which I use a webBrowser control. In the control I open an external webpage that has a login page and I fill in the username and password from my code behind. But I don’t know how I push the login button or execute de page. Is there someone out there that can give me a hint of how to do that?
|
|
|
|
|
First you need to know what the id is of the button you want to click. Then you have to get the object type it correctly and do the .click() method for that type.
If you haven't already I would add a reference to the microsoft.mshtml.dll This will give you access to the mshtml namespace which has all of the objects you might want to use their types.
Ben
|
|
|
|
|
Thank you Ben, I got it to work!
Sorry about the cross the cross post.
Niklas
|
|
|
|
|
Dear All,
i have developed a desktop based application using C#.NET, which require access to some USB based devices.
I have to use this application on target PCs in which the USB port is disabled by the system administrator.
From the application, i wants to enable & disable the USB drives programatically, so that no other application can use the USB ports, as per configured by the system administrator.
ie, enable the USB port before the application require access to the USB port it & disable it after the use.
I need to achieve the same when the application is running in a login, who doesn't have administrative rights.
Is it possible to achieve the same using .NET framework?
Do any one knows how to implement the same. If so, please inform me.
Best Regards,
Abhilash Chandran
|
|
|
|
|
Using the standard drivers for USB, you can't do what you want, no matter what language you use. Hardware is shared system-wide and is completely abstracted from your application, giving you no control over access to the USB ports. You would have to write your own USB drivers in order to support this.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I have a Windows Form app that contains a combobox (as a dropdownlist). I am able to populate the combobox. However, I am seeing some strange behaviour when I try to set the SelectedValue to an item in the list.
This is how I populate my combobox:
Method 1. This works.
// The "" indicates no custom first row. GetList() returns DataSet.
cbState.DataSource = GetList("spGetStates", "");
cbState.DisplayMember = "Text";
cbState.ValueMember = "Value";
cbState.SelectedValue = "AL" // This positions correctly
Method 2. This does NOT work.
// The "--" indicates first row in combo will contain this value. GetList() returns DataSet.
cbState.DataSource = GetList("spGetStates", "--");
cbState.DisplayMember = "Text";
cbState.ValueMember = "Value";
cbState.SelectedValue = "AL" // This does NOT position correctly.
The only difference between Method 1 and 2 is that Method 2 inserts a row into the dataset. If I were to use "AK" in method 2, it would work correctly. There is something about the second row in table.
Here is the method that populates DataSet:
public static GetList(string spName, string FirstRow)
{
// Populate dataset. Some code left out to keep it simple
ds = ....;
if (FirstRow.Length > 0)
{
DataRow row = new DataRow();
row["Value"] = FirstRow;
row["Text"] = FirstRow;
// Add row to top of list
ds.Tables[0].Row.InsertAt(row, 0)
}
}
Here is some sample data:
EXAMPLE 1 (using "--" parameter)
value text
------------
-- --
AL Alabama
AK Alaska
EXAMPLE 2 (using "" parameter)
value text
------------
AL Alabama
AK Alaska
Any thoughts on how to get the positioning to work for Method 2 using the value "AL"?
Thanks.
Steve
|
|
|
|
|
I am not totally sure I understand the question, but you can not set the selected item by setting the selectedValue or selectedText. You can only set the selected Item by using the SelectedIndex and SelectedItem. If you want to select AL then you would need to do something like:
You might need to loop through the comboBox to check the value and find the index.
cbState.SelectedIndex = columnIdx
Hope that helps.
Ben
|
|
|
|
|
I have seen a way to do this a week ago, but cannot find the link. I want the user to view all the items in the combo box, but I don't want them to change the value. Has anyone seen this link or know the answer? The combo box is on the form. It is not in any other control. Thanks
|
|
|
|
|