|
For doing merge, I will have to save the contents of RichTextBox in a file, & then merge that file in Document. Can't the other way out be worked. As this merge will increase 2 steps of my procedure. Additionally, I tried but, the following code gives me error
<br />
For i = 0 To 2<br />
<br />
' Load file in RTB<br />
rtb.LoadFile("\Sample1.rtf")<br />
<br />
' Make Changes in rtb text - Replacing some text<br />
rtb.AppendText("DOCUMENT " + i.ToString())<br />
rtb.SaveFile("\Sample1Temp.rtf") '*********** Error<br />
rtb.Clear()<br />
' Assign rtb text to wDoc<br />
wDoc.Content.Text = rtb.Text<br />
<br />
' Insert a page break in the word document<br />
wDoc.Content.InsertBreak(wdPgBrk)<br />
wDoc.Merge("\Sample1Temp.rtf")<br />
Next<br />
Once the For loop is executed, first time Sample1temp.rtf is merged in the WDoc object. Second time, on saving Sample1Temp.rtf, gives error "saying it is already in use with other process."
Thanks
Terry
|
|
|
|
|
Dear everyone...
i have problem that i have 10 listboxes onto my form.
i want to display a command button but it should be displayed along with the same listbox where i am present or where i am recently clicking.
so i need to store the active control name in a variable.
please tell me that how i can get current control name.
thanks
|
|
|
|
|
sorry to say that but i just can't understand your problem, can you please describe it more.
as much i think, you need a button when you select a listbox out of your 11 list boxes(am i right). make a button on runtime and make it show hide or set its visible property to true or false as per your need on given position. you have to add a handler to handle its events and don't forget to dispose the handler when you don't need it.
hope this help
help everyone
|
|
|
|
|
Try This:
Have a variable accessible to all subs.
Dim LastControl as Control
Then on each of the listboxes click event put this.
LastControl = sender
Then on the command button click:
LastControl should equal the listbox last clicked.
|
|
|
|
|
Why is that property AutoCompleteCustomSource of a TextBox wont work when you set its property as multiline?? and once you bring it back as non-multiline textbox then it works and show the AutoCompleteSource?
what if i want to use a textbox as multiline and to show autoCompleteSource once it TextChanged occur?
Please anybody there who can explain it to me briefly...
and if anyone have the idea how to do that???
Thanks... I appreciate to anyone who reply with me..
Thanks again...
|
|
|
|
|
please remove the double entry of your question.
help everyone
|
|
|
|
|
Not supported. I wouldn't expect a multiline TextBox to use AutoComplete.
Here's the problem with trying to do it: Are you trying to use AutoComplete on the entire contents of the multiline TextBox, or are you tryin to use it on each line of a multiLine TextBox??
|
|
|
|
|
In a previous program I was able to add the reference Microsoft.Office.Core
This enabled me to open Excel in the background using my VB.Net Program.
With the new program however when I go looking for the same reference I can only add...
Interop.Microsoft.Office.Core
I think this is the reason for my error
"'New' cannot be used on an interface."
My code looks like this
xlsApp = New Excel.Application<br />
xlsApp.Visible = False
If I try to bring the "Microsoft.Office.Core" across by adding a reference, it sees the "Microsoft.Office.Core" but imports it as "Interop.Microsoft.Office.Core".
Grateful for any helpful suggestions.
|
|
|
|
|
frankiebaby2 wrote: If I try to bring the "Microsoft.Office.Core" across by adding a reference, it sees the "Microsoft.Office.Core" but imports it as "Interop.Microsoft.Office.Core".
I don't do Office Interop at all, so this may be wrong.
But, did you add the reference to the Excel Object Library under the COM tab, or did you use the Office Primary Interop Assemblies under the .NET tab??
|
|
|
|
|
Thanks Dave, I did add it in under COM, and have it running. Thanks for answering.
|
|
|
|
|
The files I read and write must be compatible with legacy programs (VB6, C++).
The file is header information followed by a data array. For example;
'This is the current file header.
Private Structure CvsImageStructure
Friend FileID As Byte
Friend Rows As Short
Friend Columns As Short
Friend Images As Short
Friend StoredDataType As Byte
Friend CompressionSlope As Single
Friend CompressionIntercept As Single
Friend SerialNumber As String
Friend DefectDescriptions As String
End Structure
The next part of the file is a data array. It may be Byte, Int16 or Single. The StoredDataType element in the header tells me what the data type is.
I can read the data one element at a time in a for next loop (i.e. BR.ReadSingle). However, this is painfully slow. In some cases there will be more than 1,000,000 elements in the array. Is there a way to quickly read the entire data array into a Single precision array (or Byte or Int16)?
Some of these files were created in VB6 using the Put command
i.e.
Put #1, header
Put #1, sImageData()
The legacy program uses the VB6 Get command to read the files. It has to be able to read the files I create in VB.Net 2005.
-----
When the DefectDescriptions element of the structure in the file is blank, the binaryreader returns 73 characters (BR.ReadString), reading into the data array. I have a work around for this, but would appreciate some help correcting this problem.
|
|
|
|
|
Dave_6 wrote: Is there a way to quickly read the entire data array into a Single precision array (or Byte or Int16)?
Use ReadBytes to get the data into a Byte array, then use the BitConverter class to convert each set of bytes in the array to an Int16 or Single element in your array.
A quick and dirty example... Read a file containing 1,000,000 Singles and convert it to an array:
Using fs As New FileStream("C:\test.dat", FileMode.Open)
Using br As New BinaryReader(fs)
Dim buffer() As Byte
buffer = br.ReadBytes(fs.Length)
' A Single is 4 bytes long...
Dim singles(1000000) As Single
For x As Integer = 0 to 1000000 Step 4
sa(x \ 4) = BitConverter.ToSingle(buffer, x)
Next
End Using
End Using
The nice part about this method is that you can modify it to conver the Byte array into any size values you've read by simply changing the Step value and using a different conversion method on the BitConverter class.
|
|
|
|
|
Hi, I'm looking for an example or some tip on how to display the information from a datagridview row that the user has selected into my corresponding textboxes and listboxes on my form. The user should be able to enter data into either the textboxes (or select data from a listtbox) or the datagridview and the dataset is then updated. Is there maybe a specific event that I need to put code in? How do I select a row and display the data, do I need to loop through the datagridview rows? any help please?
Mr Oizo
|
|
|
|
|
if your using a datagrid you could do something like:
private datagrid1_click(Byval.......)handles datagrid1.click<br />
'When user clicks row in grid display column info in textbox<br />
<br />
textbox1.text = datgrid1.item(datagrid1.currentrowindex, column#) & ""<br />
<br />
end sub<br />
<br />
Private textbox1_textchanged(Byval......)handles textbox1.changed<br />
'Probably will need this to handle null values in for all columns that dont like null values...use if needed<br />
<br />
if datagrid1.item(datagrid1.currentrowindex, column# is system.dbnull.value then<br />
textbox1.text = ""<br />
else<br />
'call your store procedure - or whatever your using - nested if statement will be good to use if have multiple columns that dont like nulls<br />
end if
If you dont like typing you can user datagrid1.item(columnrow#, column#)
Thank You
|
|
|
|
|
Hi Friends,
Any body can help me.
I make an MDI app using .Net.
The parent form has a MainMenu.
The questions:
1. When I open a child form, before the first menu item a picture is shown
(the form picture). How can I hide this picture.
2. When I open a child form, before
to set windows state maximized
to set maximumize box false
to set minimize box false
to set control box false.
those are enabled.
Thanks in advance,
Rameshkumar Thirumalaisamy
|
|
|
|
|
hey guy
don,t confuse with this type bcoz its just a structure how to attach a file in mainmenu remove it all and add ur file in that menu by change name
if u want to add form in mainmenu then write code
dim a as new form
a.mdiparent=me
a.show
simply
hope u understand
if any problem mail me
byeeeeeeee
lucky
|
|
|
|
|
How will I show the child table within the parent table without having to clink on the link - example My main grid loads up fine and it shows the '+' '-' to expand the table, but when I click the '+' I get "datarelation" link once I click that link the table expands.
Is it possible to do this with just one click on the '+'? Dont want to use two datagrids, because I want all the info on one grid. Will I have to purchase a third pary product to do this? Here is my code below - am I doing something wrong?
Dim command1 As New SqlCommand("Select * FROM LateOrders_Header_view", cnn1)<br />
Dim command2 As New SqlCommand("Select * from LateOrders_Line_view", cnn1)<br />
'Dim SqlReader As SqlDataReader<br />
Try<br />
cnn1.Open()<br />
<br />
'Debug.WriteLine(cnn1.ConnectionString)<br />
Dim dt As New DataTable("LateOrders_Header_view")<br />
dgOrderReport.DataSource = dt<br />
Dim DirAdapter As New SqlDataAdapter(command1)<br />
Dim DirAdapter2 As New SqlDataAdapter(command2)<br />
Dim dc1 As DataColumn<br />
Dim dc3 As DataColumn<br />
Dim datarelation As DataRelation<br />
<br />
MyDataSet = New DataSet<br />
DirAdapter.TableMappings.Add("tabel1", "LateOrders_Header_view")<br />
DirAdapter.TableMappings.Add("tabel2", "LateOrders_line_view")<br />
<br />
DirAdapter.Fill(MyDataSet, "LateOrders_Header_view")<br />
DirAdapter2.Fill(MyDataSet, "LateOrders_Line_view")<br />
<br />
dc1 = MyDataSet.Tables("LateOrders_Header_view").Columns("order_no")<br />
dc3 = MyDataSet.Tables("LateOrders_Line_view").Columns("order_no")<br />
datarelation = New DataRelation("Line View", dc1, dc3)<br />
MyDataSet.Relations.Add(datarelation)<br />
'dc3.ReadOnly = True<br />
<br />
dgOrderReport.DataSource = MyDataSet.DefaultViewManager '.Tables("LateOrders_Header_view").DefaultView<br />
dgOrderReport.DataMember = "LateOrders_header_view"
Any Ideas?
Thank You
|
|
|
|
|
so wht,s the problem simply just apply the condition on + button and - button. +button.click=dgv1, dgv2 else false
hope u understand
byeeeeeeee
lucky
|
|
|
|
|
Nope I dont understand -
I dont have any button conditions because of this below-
datarelation = New DataRelation("Line View", dc1, dc3)<br />
MyDataSet.Relations.Add(datarelation)
creates the + - condition on the grid. When the app is running when I click on a record it expands and you see a link that says "Line View" once I clink that link it opens a different table - I dont want it to do that I want it to show the nested table with just one click on the row
Is there away to raise a condition to control the + and - that comes with datarelation? Oh Yea I'm not using two datagrids - One datagrid with two datasets. Well One dataset two tables.
-- modified at 8:28 Friday 7th September, 2007
-- modified at 9:30 Friday 7th September, 2007
Thank You
|
|
|
|
|
Description
I am making a Paint Brush Like application in Vb 2005. My intention is to join the points by draw line method as the mouse moves. I am facing some issues as the “AutoRedraw” is not available for PictureBox.
To overcome this shortcoming i started coping the screen as image using "CopyFromScreen”, ad loding that image in the PictureBox, as the lines are drawn. My issues with this solution are :
- The process of saving and loading the Image in picture box had made the application very slow, which intern are making me loose some points.
- My intention is to use a Picture box (Drawing area for the users), bigger then the screen. It is becoming very difficult to exactly calculate at which portion of the picture box i am taking a snap of and where to put it in the Image of picture box.
What all had tried
- I moved the "Saving from screen and loading back in the PictureBox " codes to a timer: Codes do work but the points which i am getting while the timer calls the codes to save the image are missed
- I tried putting the codes to save image in a thread... not able to succeed
Can any one please help me with it I am in urgent need of this
Platform
VB 2005 /Express IDE / Sharp Developer
Nishkarsh
|
|
|
|
|
Hi,
two comments:
1.
a PictureBox is not the right Control for this; its purpose is to show an existing Image,
no more, no less. Yours is not an Image, it is a painting that keeps evolving. So
I would suggest you take a simple Panel.
2.
The normal draw approach is to:
- have some data structures that represent the entire content of your drawing/painting;
- use keyboard/mouse events to modify these data structures;
- have the Paint handler "execute" the data structures, i.e. do the actual Graphics
operations.
As a result, you have:
- data structures ready for saving/restoring your structured document to /from file
- a visible result that gets redrawn automatically whenever it needs to (e.g. because
you resize the Form, uncover it, etc).
- the possibility to resize your drawing/painting based on its high-level representation
(such as font size), rather than pixel-based.
Now for real painting, the above may be rather difficult; if so, you could use a Bitmap,
create a Graphics for it once (with Graphics.FromImage; keep it in a class member),
and paint into that Graphics from your keyboard/mouse event handlers, then Invalidate()
your Panel. In the Panel's Paint handler simply DrawImage() the Bitmap.
But don't first paint on the screen, then try to capture the screen. That is inefficient
at best.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi
Luc Pattyn
thanks for the info...
I will like to let my problem in more detail...
I have to use a tablet attached to the PC which acts as a input device for user
Was successfully able to do all what i told in my question in Vb6
Now when i migrated the code to Vb 2005 I was Not able to do it properly...
Issue is, the tablet sends packets as the user user writes on it... The tablet is of A4 size and the user can write on whole page
If i Use a data structure to store all points and then draw lines between them then one thing the data structure becomes too big and in low config system there is a threat of crashing or system becomes slow
other aspect is that a user will like to see what he writes in a similar size as what e is writing inso i need to make the picture box big which scrolls on the window...
As you suggested, if I use a panel then can i do all the above??
|
|
|
|
|
Hi,
1.
yes I would use a Panel for this.
2.
I would also try and avoid scrolling.
What is the resolution of the tablet (how many points can it discern horizontally and
vertically) ? if that is less than there are pixels on the screen, I would do a one-on-one;
if the tablet resolution is quite different, I would use some scaling so it still fits
the (height of the) screen.
3.
Assuming a lot of data is coming in, I would use the bitmap approach: allocate a bitmap
of the right size, get a Graphics for it; then accept tablet input and paint into the
bitmap using that Graphics.
4.
New suggestion: don't Invalidate() everytime you modify the bitmap, just set a boolean flag.
Then install a Windows.Forms.Timer that ticks say once every 100 or 200 msec; in its
tick handler, if the flag is set, clear the flag and Invalidate the Panel.
As a result you can accept data at full speed, and your screen would be refreshed every
100 or 200 msec (rather than every time the bitmap changes).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
All of my applications have migrated to VB 2005. They all start from Sub Main in a module.
Today I decided to create a new one and set "enable application framework" to true so that I can explore its new features.
The program has been run many times as I add new components. There have been no apparent problems.
I added code that creates a delegate to display the program's name and a date/time string as Form1's text.
It is invoked once a second by a thread spauned by my "Clock" class that runs on a background thread.
I encountered this error when it ran.
Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
How does one create a handle for Form1?
Why wasn't it created automatically when the application started?
Thanks
RCarey
RCarey
|
|
|
|
|
RJGCarey wrote: How does one create a handle for Form1?
You don't. It's automatically created.
The problem is caused by your code not waiting long enough for the window to be completely created. Basically, you're trying to update the window before it exists.
You can either delay starting your "Clock" class or, in the update code, check the Form's IsHandleCreated property before you try to update the Form.
|
|
|
|