|
I've used Access for a long time and never had a problem. I've used VB.net for about 3 months and was surprised that this was the case and therefore the question. I don't get any error, just 0 or Null when the control property set to false.;)
|
|
|
|
|
Is their any code that can shred files so that they cannot be recovered?
Can i use directoryinfo.delete to delete files so that they cannot be recovered?
Thanks for any help!
|
|
|
|
|
A***** wrote: Is their any code that can shred files so that they cannot be recovered?
Sure, but it depends on who you want this functionality.
If you want when any file is deleted by any method, you'll have to write a file system extension (I don't recommended doing it with VB.NET or C#!). A much easier method woiuld be to install a third party solution to do it. It's the difference between 2 minutes of work and 3 months that would probably tell you if it's worth it.
If you just want your applications data files to be shredded, then you'll have to put overwrite code in your app to shred the file before you delete it.
A***** wrote: Can i use directoryinfo.delete to delete files so that they cannot be recovered?
Nope.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I heard somewhere that all you have to do to permanently delete a file, is overwrite the it several times with random data before deleting it. This way it distorts the original data so no one can recover it. Whether or not that actually works, I'm not sure (I've never tried it), but it's worth a shot.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Is there a simple way to print a small form? I have a single form, like a calculator. I want to be able to click a button and print the form.
I have read many good articles on more complicated printing using .Net however I am hoping I can do this with just a couple lines of code.
Thanks
Rehabman2000
|
|
|
|
|
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
|
|
|
|