|
Drop this control[^] on your form and then (in design mode) set the MCL Print Form extended properties for each control on the form you want to print...
|
|
|
|
|
|
end
with regards
Balagurunathan.B
|
|
|
|
|
Tell your startup form to Close. If the application's message pump is shutdown, all the windows opened under it shutdown and close with it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am totally frustrated - I am trying to display questions from a question table (I don't know how many there will be) and then provide the users a place to type in thier responses. Then capture those responses in another table along with the question ID's.
I am new to VB.NET and so I am sure there is a simple way to do it, but it eludes me. I have tried the data grid which displays the questions nicely, but I do not know how to tie in the responses. My collegue suggested using the Repeater, but I cannot get my head around how that will help.
Any direction would be appreciated. Thanks.
Nancy
|
|
|
|
|
You can do it with a datagrid. I would:
Add a new bound column change it to a template column. Set the label to be bound to the question id. Mark the label as hidden. (visible = 'false'
Next add a new bound column change it to a template column.
Edit the template and remove the label and put in something like a textbox.
Add a submit type button to the form. In the code behind do a for each row in data grid type foreach loop. On each row do a FindControl once for the label that has the question id, once for the textbox that has the answer. Save the data to your answer table.
The only thing I would worry about is paging. If you leave paging off and have 100 questions your web page gets pretty long. If you need to turn paging on things get a bit more complicated.
Hope that helps.
Ben
|
|
|
|
|
Thank you so much - I'll give it a try!
Nancy
|
|
|
|
|
Here is the code used for a SaveAs dialog.
SFD.Filter = "Rich Text Files|*.rtf|Text Files|*.txt|WORD Files|*.doc|HTML Files|*.html|All Files|*.*"
How do I get just the extension that is chosen so that strExt reflects the choice made?
currentFile = SFD.FileName
strExt = SFD.Filter.ToUpper()
End If
Select Case strExt
Case ".RTF"
|
|
|
|
|
You just need to get the extension from the filename. You could parse it yourself or just use system.io.Path.GetExtension(currentFile).ToUpper.
|
|
|
|
|
Hi TF,
That's what I thought and what I had, but if you save a Document with the name
Testing.Text then no matter what is in the Filter Index of the dialog box the Document is saved as a Text File.
Where as you should be able to save it as Testing.Text.Extension from SaveAs Dialog.
|
|
|
|
|
Your right I checked it out. It seems if you have included an extension in the file name it won't append the selected extension. Typically when I save a document the extension will be appended unless I enclose the filename in quotes. I would expect that same behavior from the SaveFileDialog but I guess not. If there is a way to enforce that type of behavior I can't figure it out. However, there is a FilterIndex property. You could use that to figure out which extension was selected. You could just use the number it returns for your select case. Or you could split the filtered string and pick out the selected extension.
Dim exts As String() = SaveFileDialog1.Filter.Split("|") The above will create an array with the extensions in every odd index. To pick out the right one just use
exts(SaveFileDialog1.FilterIndex * 2 - 1) This will of course return the extension in your filter string which looks like *.txt so you'll have to take that into account.
|
|
|
|
|
Thanks TF
I knew it was interesting, there must be a way as you can do it in Word.
I will give what you have suggested a try and let you know how I get on.
Graham
|
|
|
|
|
Yeah it won't create the new filename for you. Your code actually has to check for a valid file extension and if it's not there, get the selected extension from the SaveFileDialog and append it yourself.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Now this is interesting, below is the code.
If I enter a SaveAs name 'Test' with a filter ext of txt.
Then I get a Test.Text Document (Correct)
but if I use the file name Test.Text with a filter ext of txt.
I get a Test.TEXT File, why?
#Region "Save File"
Private Sub SaveFile(ByVal SaveAs As Boolean)
Dim strExt As String
'If the currentFile already has an ext get it and change it to UpperCase
strExt = System.IO.Path.GetExtension(currentFile).ToUpper()
'Place it in the SFD.Filter
Select Case strExt
Case ".RTF"
SFD.FilterIndex = 1
Case ".TXT"
SFD.FilterIndex = 2
Case ".DOC"
SFD.FilterIndex = 3
Case ".HTML"
SFD.FilterIndex = 4
Case Else
SFD.FilterIndex = 5
End Select
If SaveAs Then
SFD.Title = "QuickWord - SaveAs File"
SFD.DefaultExt = "rtf"
SFD.Filter = "Rich Text Files|*.rtf|Text Files|*.txt|WORD Files|*.doc|HTML Files|*.html|All Files|*.*"
SFD.FileName = currentFile
If SFD.ShowDialog() = Windows.Forms.DialogResult.Cancel Then Exit Sub
If SFD.FileName = "" Then Exit Sub
currentFile = SFD.FileName
Dim exts As String() = SFD.Filter.Split("|")
strExt = exts(SFD.FilterIndex * 2 - 1)
Dim charsToTrim As Char() = {"*"}
Dim trimmedPath As String = strExt.TrimStart(charsToTrim)
strExt = trimmedPath
strExt = strExt.ToUpper()
End If
Select Case strExt
Case ".RTF"
rtbText.SaveFile(currentFile, RichTextBoxStreamType.RichText)
Case ".DOC"
' Copy the contents of the Richtextbox to the clipboard and keep it's formating
Clipboard.SetText(rtbText.Rtf, TextDataFormat.Rtf)
objWord = CreateObject("Word.Application")
objTempDoc = objWord.Documents.Add
With objTempDoc
.Content.Paste()
.SaveAs(currentFile)
End With
objTempDoc.close()
objWord.Quit()
Case Else
Dim txtWriter As System.IO.StreamWriter
txtWriter = New System.IO.StreamWriter(currentFile)
txtWriter.Write(rtbText.Text)
txtWriter.Close()
txtWriter = Nothing
rtbText.SelectionStart = 0
rtbText.SelectionLength = 0
End Select
rtbText.Modified = False
Me.Text = "QuickWord: " & currentFile.ToString()
End Sub
#End Region
-- modified at 16:01 Thursday 8th March, 2007
|
|
|
|
|
I can't tell from the code given. I suspect when you set currentFile something is happening but that code isn't here. Is the value of currentFile coming straight from SFD.FileName or are you doing something to that value before setting currentFile?
|
|
|
|
|
TF
I've modified my last post to save space on the forum, it now contains the complete SaveAs code.
Cheers
Graham
|
|
|
|
|
Hmmm...I just don't see anything there that would cause that to happen. Just for clarification it was the capitalization of TEXT that you had a problem with, right? My only suggestion is step through your code line by line when it saves. Also as your doing that determine if the capitalization is occuring from the dialog itself of it that happens after. Sorry, I just can't see it, but just so you know when I tried it with a savefiledialog I couldn't recreate that problem.
|
|
|
|
|
Thanks TF at least you had a look.
|
|
|
|
|
I'm starting the process of learning/exploring the GDI+, and I have a question about polygons. Is it possible to render/create a multipart polygon. Say for example an outer edge polygon with a hole/island in the middle of it (e.g. a dough nut). Just curious.
Thanks in advance,
David
|
|
|
|
|
Sure. You have to calculate and/or supply all the points, then create the drawing code to "connect the dots".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
There is an issue that I am still struggling with.
What is the correct technique for calling back to classes in the main .exe from an assembly that is discovered only through reflection, dynamically, at runtime?
I created a sub in the assembly .dll:
Public shared me.host as object
sub initializeassembly(byval host as object)
me.host = host
end sub
and called that sub from the main.
the I called the (public) class in the main from the .dll:
host.subinmain()
However, I find that the class in the main is sometimes disposed of before it is called.
Is it proper to use this technique? What is the alternative? It was suggested to me that I could use an interface, but but I don't see how that really helps, because the name of the class in the main still has to be passed somehow to the .dll
Thanks as always for your time..
|
|
|
|
|
In VB.NET 2005.
I have a button that i want to put an image on (normal bitmap), so i have done via the properties menu, and the image is stored in the resources.
It shows up as being fine in the design view, but when i try to run it, it aint showing up.
Any ideas, i have never used this feature before so i am not sure if i need to do something else??
Cheers all
|
|
|
|
|
HAve you set the Image property?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi
1.Can I connect DataBound Controls to Data Control or ADODC at runtime?
2.Can connect DataBound Controls to Database Objects?
Spread wat u Know!
|
|
|
|
|
Are you using VB.NET or VB6? What do you mean by "Database Objects"? Which classes are you talking about?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|