|
Herm... that's not good. So, should I just stick with my original idea and write a text file? That's gonna be a pain... anyway, thanks for the help.
As I sit here, I contemplate the last words of Socrates: "I drank what?".
|
|
|
|
|
Settings are very easy to save in .NET, because you can serialize objects. This makes it almost trivial to create a class to represent your settings, and then use serialization to save and load it to/from disk.
See Serialization, Basic Serialization in the .NET SDK docs.
There are other ways, but that is my favourite.
|
|
|
|
|
|
|
i tried that but it gave me some weird error.
------------------------
Jordan.
III
|
|
|
|
|
Hello,
I am trying to save the date to a table from a date picker so that the next time the form is open it will have the last date picked which i will call form the table and assign it to the datepicker as the value. the problem i am having is that when i insert the date into the table which the field is formated to Date i get 12/30/1899 for every date that is inserted. Can someone tell me if there is an easier way to do this or how I Can fix this problem. below is the code i am using.
Thanks,
Santana
'delete old dates and Saves Dates to date table
Dim startdate As Date
Dim enddate As Date
startdate = pkrstartdate.Text
enddate = pkrenddate.Text
datedap.DeleteCommand.CommandText = "Delete * From datetbl"
datedap.DeleteCommand.ExecuteNonQuery()
datedap.InsertCommand.CommandText = "Insert into datetbl (startdate,enddate) values (" & startdate & "," & enddate & ")"
datedap.InsertCommand.ExecuteNonQuery()
MsgBox(startdate)
MsgBox(enddate)
newMDRConn.Close()
|
|
|
|
|
mariscal wrote:
datedap.InsertCommand.CommandText = "Insert into datetbl (startdate,enddate) values (" & startdate & "," & enddate & ")"
Stringing together an SQL statement like this is a bad idea. Instead, use a stored procedure that can validate what your putting into the table. This will also give you the ability to use SQLParameter objects that can properly convert the date to an SQL compatible DBDate and back again.
RageInTheMachine9532
|
|
|
|
|
i made a class and i am trying to save info from a textbox to it but for some reason it is not saving the info. any ideas?
|
|
|
|
|
trg5030 wrote:
any ideas?
You're going to have to supply MUCH more information that this. What does your class look like? What code are you using to create an object form the class and populate it? How are you trying to save the information from the TextBox to the object? We need to see some code samples...
RageInTheMachine9532
|
|
|
|
|
im working in vb.net
Public Class CD
Private m_CDID As String
Private m_Artist As String
Private m_Album As String
Private m_CDLocation As String
Private m_ReleaseDate As String
Private m_Burned As Boolean
Public Property CDID() As String
Get
CDID = m_CDID
End Get
Set(ByVal Value As String)
m_CDID = Value
End Set
End Property
Public Property Artist() As String
Get
Artist = m_Artist
End Get
Set(ByVal Value As String)
m_Artist = Value
End Set
End Property
Public Property Album() As String
Get
Album = m_Album
End Get
Set(ByVal Value As String)
m_Album = Value
End Set
End Property
Public Property CDLocation() As String
Get
CDLocation = m_CDLocation
End Get
Set(ByVal Value As String)
m_CDLocation = Value
End Set
End Property
Public Property ReleaseDate() As String
Get
ReleaseDate = m_ReleaseDate
End Get
Set(ByVal Value As String)
m_ReleaseDate = Value
End Set
End Property
Public Property Burned() As Boolean
Get
Burned = m_Burned
End Get
Set(ByVal Value As Boolean)
m_Burned = Value
End Set
End Property
End Class
Public Sub AddDelete()
Dim Add As New frmAdd
ReDim Preserve objInfo(Count)
objInfo(Count) = New CD
With objInfo(Count)
Add.txtArtist.Text = .Artist
Add.txtAlbum.Text = .Album
Add.txtCDID.Text = .CDID
Add.txtCDLocation.Text = .CDLocation
Add.txtReleaseDate.Text = .ReleaseDate
If Add.rbYes.Checked = True Then
.Burned = True
End If
End With
Count = Count + 1
End Sub
Public Sub Delete()
Dim Delete As New frmDelete
With objInfo(Count - 1)
.Artist = Delete.txtArtist.Text
.Album = Delete.txtAlbum.Text
.CDID = Delete.txtCDID.Text
.CDLocation = Delete.txtCDLocation.Text
.ReleaseDate = Delete.txtReleaseDate.Text
If .Burned = True Then
Delete.rbYes.Checked = True
End If
End With
End Sub
|
|
|
|
|
trg5030 wrote:
Public Sub AddDelete()
Dim Add As New frmAdd
ReDim Preserve objInfo(Count)
objInfo(Count) = New CD
With objInfo(Count)
Add.txtArtist.Text = .Artist
Add.txtAlbum.Text = .Album
Add.txtCDID.Text = .CDID
Add.txtCDLocation.Text = .CDLocation
Add.txtReleaseDate.Text = .ReleaseDate
If Add.rbYes.Checked = True Then
.Burned = True
End If
End With
Count = Count + 1
End Sub
Your making a new instance of an frmAdd form here. You then expand an array and add a new (blank) CD object to it. Then, your populating the textbox controls on the form with the information from the newly created CD object, with is all blanks. You then check a checkbox control on the form, which is never displayed by the way, and then increase the counter.
All the assignments to made are moving data (blank data) TO the form, but never FROM the form to the storage class you made!
RageInTheMachine9532
|
|
|
|
|
i reversed the statment to say
.artist = add.txtartist.text and i still get no data?
|
|
|
|
|
That's because everything you created in this sub is brand spanking new! Your not using the data from the EXISTING form at all, you're using it from a form that you create in this sub, but NEVER display. So yes, you're adding a bunch of blank information to your new CD object.
Use the EXISTING Add form you have already displayed (at least I think you did) instead of creating a new one in your sub.
RageInTheMachine9532
|
|
|
|
|
|
Hello, I´m programming a Security module for an application. To check out piracy i've been asked to verify the hard drive serial number and the BIOS serial number. I finally found a way to get hd's, but still haven't found a way to BIOS.
Can anyone help me?
Thank you anyway.
|
|
|
|
|
Troyax wrote:
I finally found a way to get hd's, but still haven't found a way to BIOS.
Easy enough to get the drive's serial number through WMI. Win32_LogicalDisk has the VolumeSerialNumber attribute.
The BIOS on the other hand isn't so easy. It's in the WMI Win32_BIOS class, but, not every BIOS HAS a serial number. My serial number on my Phoenix BIOS'd machine is "xxxxxxxxxxx". You'd be better off using various parts of the Win32_BIOS class and other pieces of information from other classes to generate your own serial number.
RageInTheMachine9532
|
|
|
|
|
Hi all,
I have a webservice (asmx) and i want to make a reference in a client project.
The problem is that i only see my datasets. We're only talking about design (not runtime environment).
example:
The webservice is called X and contains:
a dataset called ds
a function called GetDs()
The reference in the client-project is called R.
R.ds -> he finds it perfectly.
R.GetDs() -> doesn't show up in the list and gives an error when I want to use it (design time)
There's something more odd in it. R contains something called X ?!
When I call the server (asmx) I see the methods and all and they work perfectly fine.
Is there something I forgot when I builded the webservice or is there something wrong in the reference?
Your help would be greatly appreciated,
Christophe
|
|
|
|
|
I m doing on a project which requires me to do a binary file comparison. Can anyone help? How do i go abt coding it?
|
|
|
|
|
Sounds like a homework project. We can't write the code for you. You'll have to start writing the code and then we can help with specific problems.
RageInTheMachine9532
|
|
|
|
|
Private Sub CompareBinaryFiles(t1 As String, t2 As String)
Open txtOne.Text For Binary Access Read As #1
Open txtTwo.Text For Binary Access Read As #2
Dim pos As Long
Dim differencepercentage As Single
Dim o As Byte, t As Byte
Dim textOne As String, textTwo As String
Dim totalcount As Integer, differencecount As Integer
'need to initalize before computing
totalcount = 0
differencecount = 0
On Error GoTo exit2
'loop the file until EOF
Do Until EOF(2)
'count + 1 whenever the file loop
totalcount = totalcount + 1
'calculating the positioning of the file
pos = pos + 1
pos2 = pos2 + 1
If pos > txtOne Then GoTo exit2
Get #1, pos, t
Get #2, pos, o
'add the countdiffernces by 1
If t <> o Then lstMistakes.AddItem "Byte " & pos & " - " & t & " (" & o & ")"
If t <> o Then differencecount = differencecount + 1
'DoEvents
If pos Mod 256 = 0 Then PB.Value = pos
Loop
GoTo esc
exit2:
If pos2 = cut Then GoTo esc
lstMistakes.AddItem "---File ended at byte " & pos2 & " ---"
esc:
lstMistakes.Visible = True
PB.Visible = False
Close #1
Close #2
'calculating the percentage of the differnces of files
On Error GoTo errhandler
'differencepercentage = (differencecount / totalcount) * 100
List2.AddItem "Binary Compare Similarity :" & 100 - differencepercentage & " %"
List2.AddItem "Binary Compare diffences :" & differencepercentage & " %"
Exit Sub
errhandler:
Resume Next
End Sub
Is this the way to do the binary files comparison? But when i include this function my normal text files comparison will have a extra line at the end of each documents!
|
|
|
|
|
I am trying to write add-in to open a specified word document with
write and read permission for now it only gives me readonly permission with
a message saying this documne is been used by myself.
Dim WApp As Object
Set WApp = CreateObject("Word.Application")
'WApp.ReadOnly = False
WApp.Documents.Open str_FullPathToDownloadedFile, ReadOnly:=False
what could be the problem?
Shin
|
|
|
|
|
Did you run the same code before? And when you ran it before, did you close the document and shut down the instance of Word you created? If not, then a) there are 1...N instances of Word running (check your task list) and b) odds are, your word document is in use by one of them.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
>N instances of Word running (
you are right sometimes when i launch the word document it doesn't show up the winword.exe is there? i'm not sure why. by the way, do you know where i can look for help with these object class for office
application.name
application...
it's not in msdn right!? this only for add-in project?
Thanks for your help.
Shin
|
|
|
|
|
Some of it is here[^], but the best bet is to look right inside the help file for Word, etc., the go to the section called "Programming Information".
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
thanks for the information
I just found and bought a book called "visual basic Add-in" from o'relly.
I will study bit more before dive into the add-in
I really appreciate your input.
Shin
|
|
|
|