|
Or just install a PDF printer and print it from Access.
|
|
|
|
|
Hi,
I'm using a streamreader and writer for editing an excel vbaproject.bin file.
However when I read and write the file I have some differences in the codepage I think.
look at the pictures for what I mean[^]
At the left it is OK. After writing it's no longer ok (at the right)
Can some tell me what I'm doing wrong?
the code for reading
Dim s As New StreamReader(fiTemp.FullName, System.Text.Encoding.ASCII)
Dim vba As String = s.ReadToEnd()
s.Close()
The code for writing:
Dim s1 As New StreamWriter(fiTemp.FullName, False, System.Text.Encoding.ASCII)
s1.Write(newvba)
s1.Close()
I also tried without encoding
Jan
|
|
|
|
|
What's the VBA code you're using to read/write the file.
From the pictures, it appears as though you're trying to read/write a binary file and your VB.NET code is treating it as a text file. There is no encoding on a binary file.
|
|
|
|
|
|
Hi,
I have a MySql table.
Table Name : Rate
Fields:
1. CurrentDate
(DataType : Date )
2. MaterialPrice
(DataType : DOUBLE(10,3) )
In above everyday I have to enter the MaterialPrice as it changes everyday.
I created a form for the above table
I want to do that when my MdiForm loads, it checks if the Current Date data is blank and if it has no records then it open the form associated with the table(Rate).
I tried...
Private Sub FormMdi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim d As Date = Date.Today
qry = "SELECT * FROM Rate WHERE CurrentDate =" & d & ""
Try
OpenConnection()
Dim dbcommand As New MySqlCommand
dbcommand.Connection = conn
dbcommand.CommandText = qry
Dim dbread As MySqlDataReader = dbcommand.ExecuteReader
While (dbread.Read())
If dbread("CurrentDate") = "" Then
Dim f As New FormRate
f.Show()
f.Owner = Me
End If
End While
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End Sub
It not opening the form. While debugging it, I saw the control goes to
Finally
CloseConnection() directly from
While (dbread.Read()) but not firing
If dbread("CurrentDate") = "" Then
Dim f As New Rate
f.Show()
f.Owner = Me
End If and the formMdi opens.
My purpose not solved.
For your information, Table "Rate" is completely blank or has no records.
Please Help
modified 20-Jul-13 5:39am.
|
|
|
|
|
Sorry to disturb you...
I have got my solution...
|
|
|
|
|
Hi Everybody!
I've Problem when i click on label dlg.ShowDialog(), and here is my code
Private Sub LblCoCau_Err_Click(sender As System.Object, e As System.EventArgs) Handles LblCoCau_Err.Click
Dim newThread As New Thread(New ThreadStart(AddressOf ThreadMethod))
newThread.SetApartmentState(ApartmentState.STA)
newThread.Start()
End Sub
Private Shared Sub ThreadMethod()
Dim dlg As New OpenFileDialog()
dlg.ShowDialog()
MessageBox.Show(dlg.FileName)
End Sub
Error after click in lable lblCoCau_Err:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Please help me to resolve this issue. Thank's very much
|
|
|
|
|
Don't post a link to a screen-shot; use the "Copy exception detail to the clipboard" option and post the result.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Why are you creating a new thread just to show a dialog? Try it without and see what happens.
Use the best guess
|
|
|
|
|
You cannot create, show, nor touch in any way any UI items on anything other than the startup thread.
Creating a thread to show a modal dialog? That's completely pointless...
|
|
|
|
|
|
Okay so I'm very new to Encryption, I have done a lot of research via Google and I cannot find an answer to my questions, so either I'm totally not understanding this or .. okay I don't get it. Maybe someone here can help:
1. I need to generate a 256 bit Public / private key pair and store them for later use
2. I need to be able to encrypt using a stored private key
3. I need to be able to decrypt with a stored public key
(2 and 3) I was unable to find some example where keys are loaded from a file to be used, they all generated the keys new for each encryption.
And maybe someone can explain to me the way to encrypt and decrypt large files about 5 mb each with a loop, as the padding issue seems to have issues. Im trying to break up very lage files into 5mb chunks and encrypt them, then later decrypt them back into the whole file.
To me all this seems to be simple but I am at a loss when Googling this info as it all seems to derive their solutions with so many different providers and methods, and I just don't fully understand whats going on.
So the bottom like is : How can I create a Public/Private Key pair that is AES256 compliant (If that's even right) but I need a 256 bit PKI , then store them in a file to be used in the encrypt decrypt system. Can this be done without using a pass-phrase?
Again I have gotten to the point of encrypting with the use of some examples..
Here is my Generate keys function which works but im not sure if it is creating keys that I need (256)
<pre lang="vb">
Private Shared Sub Keys(publicKeyFileName As String, privateKeyFileName As String)
Dim cspParams As CspParameters = Nothing
Dim rsaProvider As RSACryptoServiceProvider = Nothing
Dim publicKeyFile As StreamWriter = Nothing
Dim privateKeyFile As StreamWriter = Nothing
Dim publicKey As String = ""
Dim privateKey As String = ""
Try
cspParams = New CspParameters()
cspParams.ProviderType = 1
cspParams.Flags = CspProviderFlags.UseArchivableKey
cspParams.KeyNumber = CInt(KeyNumber.Exchange)
rsaProvider = New RSACryptoServiceProvider(cspParams)
publicKey = rsaProvider.ToXmlString(False)
publicKeyFile = File.CreateText(publicKeyFileName)
publicKeyFile.Write(publicKey)
privateKey = rsaProvider.ToXmlString(True)
privateKeyFile = File.CreateText(privateKeyFileName)
privateKeyFile.Write(privateKey)
Catch ex As Exception
Console.WriteLine("Exception generating a new key pair! More info:")
Console.WriteLine(ex.Message)
Finally
' Do some clean up if needed
If publicKeyFile IsNot Nothing Then
publicKeyFile.Close()
End If
If privateKeyFile IsNot Nothing Then
privateKeyFile.Close()
End If
End Try
</pre>
Here is the encryption routine, again i have no idea how to have it use MY key and no password:
<pre lang="vb">
Dim rk As Byte() = Nothing
Dim riv As Byte() = Nothing
Dim salt As Byte() = System.Text.Encoding.ASCII.GetBytes("System.Text.Encoding.ASCII.GetBytes")
Dim pb As New PasswordDeriveBytes("somepassword", salt)
Dim origName As String = TmpStore & "\" & f.ToString
Dim encName As String = origName & ".enc"
cryptoKey = pb.GetBytes(32) : cryptoIV = pb.GetBytes(16)
Try
crm.EncryptData(origName, encName, cryptoKey, cryptoIV)
Dim fi As New FileInfo(origName) : Dim fi2 As New FileInfo(encName)
If (fi.Attributes And FileAttributes.[ReadOnly]) = FileAttributes.[ReadOnly] Then fi.Attributes = fi.Attributes And Not FileAttributes.[ReadOnly]
fi2.CreationTime = fi.CreationTime : fi2.LastWriteTime = fi.LastWriteTime
fi2.Attributes = FileAttributes.[ReadOnly] Or FileAttributes.Archive
File.Delete(origName)
Catch ex As CryptographicException
MessageBox.Show(ex.Message)
Catch ex As IOException
MessageBox.Show(ex.Message)
Catch ex As UnauthorizedAccessException
'i.e. readonly
MessageBox.Show(ex.Message)
End Try
</pre>
Any help is greatly appreciated. Sorry for my lack of understanding, but I am sort of under a deadline and I just cant seem to pull it off with the information out there.
|
|
|
|
|
|
Also this is not a commercial project, this is an internal project I am working on with a few people for our own personal use, mostly experimental.
I've seen that code before, it is very similar to a lot of code out there. My Issue with it is HOW to I use a Public Key of My Choosing to encrypt and Private to decrypt. Also how do I avoid using a password, and it is AES256 compliant?
|
|
|
|
|
Public key cryptography is totally separate from AES
AES is a symmetric algorithm (The person decrypting needs to share a key with the person encrypting)
Symmetric algorithms include things like RC5, AES, 3DES
Public key cryptography refers to asymmetric algorithms. (Stuff encrypted with a public key can be decrypted with a private key and stuff encrypted with the private key can be descrypted with the public key)
Asymmetric/public key algorithms include RSA, ECC.
|
|
|
|
|
Ya, I should have closed this, I got it figured out...
|
|
|
|
|
|
Hi,
I would like to get filenames from a directory and populate its name and icons in a listview.
I tried for the filename and succeded.
Private Sub PopulateData()
Dim FilePath As String = Application.StartupPath & "\users\"
Dim ContentItem As String = Dir(FilePath & "*.dat")
ListView1.Items.Clear()
If ContentItem = "" Then
MsgBox("No users found.")
End If
Do Until ContentItem = ""
ListView1.Items.Add(ContentItem)
ContentItem = Dir()
Loop
End Sub
and I am populating the listview in form loading event.
Private Sub FormCreateUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PopulateData()
End Sub
"users" is a folder from where I want to get the filename details.
But I want to get the file icons also and I don't know how to do this.
Please help.
modified 17-Jul-13 13:41pm.
|
|
|
|
|
Files do not have icons, that is just a mechanism used by Windows Explorer to help provide visual identification of different types of files. You could get the icons out of explorer, or creatre your own, and save them in your program then use the same criteria to add them to your listview. However, since you are only searching for files with the .dat extension there seems little point in having the same icon on each entry.
Use the best guess
|
|
|
|
|
|
Hi, i have a database with the following details:
SCHOOL CAMPUS ADMINNO MODULECODE MODULEGRP
SEG AMK 100810R EG3932 EG3932-G1
SEG AMK 100810R EG3933 EG3933-G1
SEG AMK 101427Y EG3901 EG3901-G1
SEG AMK 101427Y EG3902 EG3902-G1
SEG AMK 101427Y EGS650 EGS650-G1
SEG AMK 103852S EG3901 EG3901-G1
SEG AMK 103852S EG3904 EG3904-G1
now i managed to get distinct students(adminno), modulecode(subject) populate in a datagrid
also, module-students in dgv which looks like:
EG1001 ---- Student 1
----------- Student 2
----------- Student 3
EG1002 ---- Student 2
----------- Student 4
But now i want to achieve:
Modulecode --- ModuleGrp ---- numberofstudents ---- students adminno
EG3932 ------- G1 ----------- 58 ------------------ 111411H 11253U 178292I...
Can anyone advice how can i go about achieving this?
Listview? or multi Line textbox? or other choices?
using vb.net, SQL commands with OleDB to retrieve data.
Thanks in advance!
|
|
|
|
|
12345_abcde wrote: Can anyone advice how can i go about achieving this? Listview? or multi Line textbox? or other choices? A DataGridView
Roughly the same code as the previous exercise, but a different query. A complex one at that, since your data doesn't look normalized. And from which table would "NumberOfStudents" come? Not the one from the example-table.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi all,
I'm a newbie at VB.net,
I want connect to access via VB.net and manager two table with a relation type "master-child",
Master table named "Book" consists of three columns: BookID [AutoNumber], Author [Text], Description [Text],
Child table named "Chapter" with three columns: ChapterID [AutoNumber], BookID [Number], Title [Text],
Then I create an application VB.net that has one main window using a dataset with two table Book and Chapter. I make a relation between them, from BookID in the table Chapter to BookID in the master table. I use a databindingsource to manager them, the table Book is displayed by a form detail, the Chapter by a datagridview. When I delete a row in Book-table, I also want delete all chapter located it. I tried to use Tableadapter but the chapters were not deleted.
Help me,
|
|
|
|
|
When you create / edit the table definitions, make sure that you set referential integrity with "OnDeleteCascade". Then the database will handle that.
|
|
|
|
|
im working on a project at the moment and i am facing a critical problem.
The tool that i have created using vb.net vs 2010 ultimate opens a "webbrowser" inside a windows form
this webbrowser displays a combination of not static banners from another server.
These banners hav an onclick event that opens a webpage.
For example : if you click on the puma banner, IE browser opens the official puma page.
My problem is that when it is opening with IE, no problem at all. The page is opening and loading normally.
whenever i use the "Process.Start(e.ToString())" to open it with the default browser,the default browser launches but with
url: System.ComponentModel.CancelEventArgs
the function is so simple to write but somehow, i am not able to assign a e.url.tostring to the process.start knowing that im using it in the newwindow event.
in the newwindow event, if i change the definirion of e as System.ComponentModel.CancelEventArgs to e as System.Windows.Forms.WebBrowserNavigatingEventArgs then it will always open with IE
i have been trying every single solution i could think of or found online so far and still ... it either opens with IE perfectly (which is not what i want- should be in default browser) Or the default browser launches onclick to the homepage of the browser.
Is there any way to record the URL called in the popup IE window and save it somewhere to be able to browse it using the process.start Or is there another way to do that.
Im kinda getting frustrated from this already
Your help will be highly appreciated
Roy
|
|
|
|