|
|
Hello I am trying to create a windows form application with VB 2008 and i am intending to read info from any textbox or whatever and export the data to word I do not know how to do it, I did some research and this is what I found :
Dim oWord As Word._Application()
oWord = New Word.Application()
But is giving me errors the word.application declaration seems to work with older version but not 2008. Please help.
I also found this code but it does not work:
Public Module DriveWord
Public Sub Main()
'Start Word in the background
Dim App As New Word.Application()
App.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
'Create a new document
Dim Doc As Word._Doucment = App.Documents.Add()
Console.WriteLine()
Console.Writeline("Creating New Document")
Console.Writeline()
'Add a heading and two lines of text
Dim Range As Word.Range = Doc.Paragraphs.Add().Range
Range.InsertBefore ("Test Document")
Range.Style = "Heading 1"
Range = Doc.Paragraphs.Add().Range
Range.InsertBefore("Line one." &vbCrLf & "Line two.")
Range.Font.Bold = True
'Save and close the current document.
Doc.SaveAs(App.StartupPath & "\test.doc")
Doc.Close()
Doc=Nothing
End Sub
regards,
|
|
|
|
|
I have created a Class called Trigger. Within this class I have set up all the properties, methods, etc. but now I am wondering if another method should be added.
Inside this class I have Shared methods GetExistingTriggers, AddDateTimeTags, and Remove. When the application starts a method called Reset is executed which calls all 3 of the shared methods above.
Class Form
Public Sub Setup
Dim tags() as String = Trigger.GetExistingTags("TRIGGERS")
If tags.Length <> 0 Then
Trigger.Remove(tags)
End If
Trigger.AddDateTimeTags
End Sub
Is it better practice to make this Setup routine a part of the Trigger class and just call Trigger.Setup? The 2 of the 3 methods would still be shared in the Trigger class becasue I need them in other places but the AddDateTimeTags could essential be removed as methods.
|
|
|
|
|
Hi,
IMO there is nothing wrong in having a class method that is built on several other class methods;
if it solves a common problem, then it increases the appeal of your class.
As an example from .NET itself File.ReadAllBytes is something you could synthesize yourself using File.Open and some stream methods but it is needed so often they rightfully decided to provide it once and fore all.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
Thanks for your response. I am still kind of new at oop and I am starting to try and figure out the good/bad and ugly way of doing things. I appreciate you posting.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
hi all
i am creating a text file for printing in vb.net (window forms)
i want to send font size while writing in the text box
Er. Jagwinder Singh
|
|
|
|
|
Are you saying you want to print with a different font?? When you render the string, you have to create a Font object to draw it with, so I don't understand the question.
|
|
|
|
|
Hi,
Any One help me, I want to upload the file on ftp server, it is simpe
but i want to display the progress bar , which define us that how much completed the uploded file on progress bar.
|
|
|
|
|
Presumably, you aren't uploading the entire file in bulk. What you need to do is set the Value property to: (int)(bytesUploaded / totalBytes) where totalBytes != 0
|
|
|
|
|
Hi all.
I've got a problem.
I'm developing an app on VB.NET, and using a treeview control.
I need to check which of all the nodes on the treeview are marked with the checkbox, and it impossible to know how many of them there are, or how deep the tree goes on the nodes level, so I have developed a recursive function, that receives the node as a parameter.
It works fine, and makes what I need. The problem is that every time I make this operation, the nodes seem to duplicate in the treeview, although it is only visually, because when I check treeview.nodes.count property, it says there are only the number of nodes I had at the beggining.
I have developed a simple app with just a treeview and a button to make this operation, and it still seems to happen so I'm becoming quite desperate. Does somebody know why does it happens??
If someone needs to see the example, I can send it by email.
Thanks.
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
Just guessing that it's something in the recursive function. Go ahead and post your code so we can see it. If needed, make a generic example with your code to reproduce the problem and to be concise.
It's better to post the code here rather than send email so that others can possibly learn.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I'm sorry!! Here is the code.
I just created a Windows VB.NET application, and put on it a treeview named TreeView1 and a button named Button1. Also, insert some random nodes on the treeview, doesn't matter, because all will appear duplicated.
The recursive function is Recorre, as you can see, this function will read all the nodes on the treeview, but won't write anything on it, so, it is so weird for me when I get all the data duplicated.
Imports System.Windows.Forms
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TreeView1.ExpandAll()
End Sub
Private Sub Recorre(ByRef Nodo As TreeNode)
Dim i As Integer
For i = 0 To Nodo.Nodes.Count - 1
Recorre(Nodo.Nodes(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim TreeView2 As TreeView
TreeView1.BeginUpdate()
For i = 0 To TreeView1.Nodes.Count - 1
Recorre(TreeView1.Nodes(i))
Next
TreeView2 = New TreeView
TreeView2 = TreeView1
Me.Controls.Remove(TreeView1)
TreeView1 = Nothing
TreeView1 = New TreeView
Me.Controls.Add(TreeView1)
TreeView1.Width = 176
TreeView1.Height = 242
TreeView1.Top = 12
TreeView1.Left = 12
TreeView1.CheckBoxes = True
TreeView1.Refresh()
TreeView1.EndUpdate()
TreeView1 = TreeView2
End Sub
End Class
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
I don't get a duplication of nodes, I don't get any nodes back on treeview1. It would appear that your temp. clearing the nodes in treeview1 and then readding them?
Having said that, I would do several things different. Instead of completely getting rid of treeview1 and readding it to the form and setting its properties, just clear the nodes (treeview1.nodes.clear). Probably don't need to create a whole another treeview to store the nodes (seems overkill), could use a treenodecollection instead.
Again, I'm not sure what this is supposed to do other than restore the nodes?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
It seems to be a problem when sending the node byref,
using byval I don't get the error... O_o
So, the code could be just like this:
Imports System.Windows.Forms
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TreeView1.ExpandAll()
End Sub
Private Sub Recorre(ByVal Nodo As TreeNode)
Dim i As Integer
For i = 0 To Nodo.Nodes.Count - 1
Recorre(Nodo.Nodes(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
For i = 0 To TreeView1.Nodes.Count - 1
Recorre(TreeView1.Nodes(i))
Next
End Sub
End Class
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
I have multiple list boxes and have different items as follow :
ListGroup1 ListGroup2 ListGroup3 ListGroup4 ListGroup5
g1_items1 g2_items1 g3_items1 g4_items1 g5_items1
g1_items2 g2_items2 g3_items2 g4_items2 g5_items2
g1_items3 g2_items3 g3_items3 g4_items3 g5_items3
listallitems
g1_items1
g4_items3
g4_items1
g5_items2
g2_items3
g4_items2
g3_items3
g2_items2
g3_items2
g5_items3
g1_items2
g1_items3
g2_items1
g5_items1
The Items aboved are added from a combobox which is linked from a table.
So what I want to implement is that on a ListGroup's DoubleClick event as I removed the listgroup Item
from the listGroup I should corresponding delete thesame item from listallitems...
how can I implement this?
|
|
|
|
|
You could create a generic sub that binds all the listboxes to the same method (tacking on the all appropriate listboxes at the end of the method declaration).
Private Sub RemoveAllMatchingListBoxRecords(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick, ListBox2.DoubleClick, ListBox3.DoubleClick
'Add code here to delete the appropriate record from each listbox in whatever means you need.
End Sub
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
hi to all,
Another problem here
I want to re size the sockwave object(a flash image) dynamically the same size as the form size.(since size of the form may differ with different resolution monitor). But its not happening. I tried with acnhor property too.
Can anyone give me the exact syntax how to do it?
thanks in advance
I am a beginner
|
|
|
|
|
Hi to All,
Here is one more problem I am facing. While creating the Set Up and deployment project. Every time I try to change the property of set up project as released, but it changes to debug every time. And as a result it always makes the setup into debug folder. please tell me, Why so? or is it normal?
Also it creates 2/3 files . setUP, windows installer package . what are these exactly? which one has to be shipped to the client?
Thanks in advance
I am a beginner
|
|
|
|
|
Debug and Release are only a setting in your designer. Normally you develop your application in Debug mode, so you can test it. Then when you are ready you change the mode to release, and (re)build the solution (not just the project).
The build process will create an Setup.ini, Setup.exe and YourAppName.msi These three files need to be shipped to the client. Also, if you have referenced any third party drivers, you may have to include those as well. Best is to install your app on a test PC and start it. That will tell you if you have all the necessary files.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi People, I am Writing a Windows application on a 1028 * 800 Screen Resolution Computer....I want to install it on a 800* 600 Computer but the Controls and the Forms look awful, I have tried using the Anchor and Dock properties with no avail...is there any Code that i can use and like call it on every Form based on the Screen Resolution given?
|
|
|
|
|
You should have designed and layed out the application for the minimum resolution you were willing to support. There is no one piece of code that can fix this for you. You have to go back and relayout your controls with the proper and appropriate use of FlowLayout and TableLayout controls, Anchoring, Docking, and other miscellaneous container controls, such as the Panel.
It's a bit tricky to do and takes a lot of trial-and-error to figure out how everything works with your setup, but in the end, it makes your form scale to larger resolutions pretty much automatically.
|
|
|
|
|
hi to all,
could anyone please tell me which is the correct merge module to deploy the crystal report in vb.net2005
is it x86,x64 or IA64
I don't understand the what are these..
Also please tell me,can we deploy a project(include crystal report) without merge module? Because, it is running in my system, so may be i have to add some reference to my project. Thats how I thought.
Please suggest
I install the merge module x86, and i am getting the following error while installing the setup
Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
Thanks in advance
<div class="ForumMod">modified on Tuesday, March 10, 2009 6:59 AM</div>
|
|
|
|
|
hi to All,
Here is a problem i am facing to create a setup for my project.When i try to install the setup file i am getting the a message box stating setup installer is interrupted, re-install the setup file
|
|
|
|
|