|
Hi all...
I am using VS2005 with MS Access 2003.
I am creating a simple database program to store contacts.
I want to know that what should be datafield in access2003 to store image
and how can i store/retrieve image to/from database.
Thanks.
Gagan
|
|
|
|
|
Have you tried to Google[^] your question?
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Try defining a column as "OLE Object". I just did it and it worked. When you edit the table in datasheet view, right-click on OLE Object column, choose Insert Object and choose Bitmap Image. I then had to copy and paste an image into Paint to load the image into the table.
Create a form with the OLE Object column and you will see the image displayed on your form.
I'm not sure if I would use this technique if your database is going to have thousands of images stored, the database size could grow to an unmanageable size.
|
|
|
|
|
Thanks for your help.
OLE Object is working.
Gagan
|
|
|
|
|
i wants to fill propertygrid , but i don;t wants to fill this propertgrid from class properties . becuse class properties are fixed, but in my requirements its not fixed . properties name and values are static.
Muhammad Ismail Khan
SoftWare Developer CRM(Islamabad), Pakistan
|
|
|
|
|
Please stick to the one thread. What do you mean 'class properties' ? The properties on the class are the only ones you can set on the class.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
What happened to the rum?
|
|
|
|
|
You can't do this. The PropertyGrid only works with Public properties of a class.
|
|
|
|
|
ya i need it .... and then wants to assign this object
to propertygrid..
Muhammad Ismail Khan
SoftWare Developer CRM(Islamabad), Pakistan
|
|
|
|
|
That's the most retard question ever. What properties ? Assign how ? I suspect you want to use reflection, but it's just not remotely clear to me why you'd have to - if you know the object, write code to set it's properties. Why would your code be given objects it knows nothing about ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Christian Graus wrote: That's the most retard question ever.
I wouldn't go that far, but its got to be a good candidate
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Is it still rum-time? Hold the ice, please
http://www.codeproject.com/script/Forums/View.aspx?fid=1646&select=2785076&fr=26#xx2785076xx
Adding a property to a class, during runtime? You could generate the code for a class that inherits everything, compile it during runtime, and dynamically load the generated assembly. Though it may be technically possible, it's a bad idea.
What are you trying to achieve?
|
|
|
|
|
eddyvluggen wrote: What are you trying to achieve?
Yeah, I already said the same thing you did. This is his reply to the very same question. Since he refuses to get off the idea and say "I just need it!", I refuse to help and point out any other possible solutions that would be easier to implement and support.
|
|
|
|
|
i am sending messages over the network.
i am doing that by first creating a message object and it has :
-timecreated as date
-priority as integer
-sourcenode as enum (what part of the sender is creating the message)
-targetnode as enum (wat part of the reciever has to solve the message)
-sourcename as string (the sender name)
-targetname as string (the reciever name , because multiple receivers could be on the same socket)
-command as enum (to tell the part of the reciever what to do)
-pvalue1 as object (custom extras)
-pvalue2 as object (custom extras)
-pvalue3 as object (custom extras)
these messages are (de)serialized to :
- string , to show them to my logscreens, and script them when needed in the future
- stream , to send them over the network
My Problem is with the command-enum , my list is becoming extremely big !
I am now in the progress of changing the enum into a class , with x number of classes in it, with x number of enums in it.
I am doing this because it looks/feels nice when i type code , meaning : CmdE.General.Nada
But now my questions start:
-do i have to declare command as object , is there a trick to not have to ?
-how do i check if command = cmde.general.niks ?
-do i have any heavy changes to expect ?
Jarno Burger
Video Jockey
|
|
|
|
|
Hi,
I don't think you can achieve hierarchical enums. This is the closest I got
(sorry, I am using C# here, I trust VB.NET supports similar things):
abstract class enumbase {
public enum general { };
public enum special { };
}
class cmdA : enumbase {
public new enum general {
een, twee, drie
}
public new enum special {
een, twee, drie
}
}
class cmdE : enumbase {
public new enum general {
niemendal1
}
public new enum special {
niemendal2
}
}
class test {
enumbase.general my0=cmdE.general.niemendal1;
enumbase.general my1=cmdA.general.een;
enumbase.special my2=cmdA.special.twee;
}
and now the problem is the "my" things have a specific type, there is
no user-selectable base type for all the enums (enumbase is not OK
since that is a class, whereas the "my" things are enum values, hence ints.
One ugly way to overcome this is by using ints and casting, as in
int my0=(int)cmdE.general.niemendal1; . If you do so, there
is no need for the abstract class enumbase any more, since you can cast
all unrelated enums to ints anyway.
Having no way to do this ina clean way seems logical, you probably want
all enum values to be different, the only way to enforce that in programming
languages such as C/Java/C# is by putting them all inside a single large enum.
And unfortunately you can't split them in multiple files, since
the compiler won't let you add a "partial" keyword to an enum statement.
So you are stuck to either one huge enum, or, if it fits the application,
a non-OO approach, with some bit fiddling:
assume cmd is an int with some bits indicating top-level command,
next few bits indicate next-level subcommand, etc.
int cmd=...;
int topLevelCommand=cmd & topLevelBitMask;
object command=topLevelDictionary[topLevelCommand];
int nextLevelCommand=cmd & nextLevelBitMask;
object subcommand=command.Dictionary[nextLevelCommand];
..etc
Maybe this scheme suits your needs, maybe it does not.
modified on Wednesday, October 29, 2008 9:37 PM
|
|
|
|
|
If you want the command to be an enum, you have to have all the values in the same enum. However, you can create static classes with properties to create an hierarchy for the values:
Enum AllCommands
General_Nada
Error_IO_FileNotFound
Error_IO_PathNotFound
Error_Access_Denied
End Enum
Public Shared Class Command
Public Shared Class General
Public ReadOnly Property Nada As AllCommands
Get
Return AllCommands.General_Nada
End Get
End Property
End Class
Public Shared Class Error
Public Shared Class IO
Public ReadOnly Property FileNotFound As AllCommands
Get
Return AllCommands.Error_IO_FileNotFound
End Get
End Property
Public ReadOnly Property PathNotFound As AllCommands
Get
Return AllCommands.Error_IO_PathNotFound
End Get
End Property
End Class
Public Shared Class Access
Public ReadOnly Property Denied As AllCommands
Get
Return AllCommands.Error_Access_Denied
End Get
End Property
End Class
End Class
End Class
Now you can get the FileNotFound command either by using AllCommands.Error_IO_FileNotFound or Command.Error.IO.FileNotFound .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I would like to know if there is a way to capture the event of another class??
|
|
|
|
|
Hi there
I don´t know exactly if you want this, but you can capture the event of the class with 2 ways:
First:
The declaration of the class is not in a function, it´s a global var. You can declare it like that:
Private WithEvents Client as ClientClass
And then you can set the handler of the event in a function, like that:
Private sub OnClientLogin (sender as object, e as eventArgs) handles Client.Login
Or you can set hte handler in the code:
Private sub SetClientEvents()
.....
addHandler Client.Login, addressof OnClientLogin
.....
end sub
Second:
If you have a class declared in the method, you can use addhandler
Private sub AddClient()
...
dim Client as ClientClass
...
addhandler Client.Login, addressof OnClientLogin
...
end sub
--------------
I think that is it what you want.
-----
LeandroAB
|
|
|
|
|
i made software which maintain a database of an institute.the institute have two department.i made adatabase in access(it has a column name department) and alredy connected it .it is fine and running in the software i have a form where i put A MSHFLEXGRID TO VIEW THE DATABASE.but now i am willing to filter the students accoording to the department and view them in two separate mshflex grid.(as the institute have two department).so please help me in this case by providing the code.thanks in advance.(***i am doing all this in vb6***)
|
|
|
|
|
Sorry, but we are not going to do your work for you. First, try to code it and when you get an error you cannot figure out then come back.
Blog link to be reinstated at a later date.
|
|
|
|
|
VB6 is crap, have you thought about using a real language instead ? Vb.NET is full of easy to use grids.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Death to vb6! Take vb6 to the noose!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hello everybody. I have a file that is spaced with NULL instead of standard spaces. LIKE SO...
COMPANYNAME
C(NULL)O(NULL)M(NULL)P(NULL)A(NULL)N(NULL)Y(NULL)N(NULL)A(NULL)M(NULL)E(NULL)
I'm trying to make a utility that will remove or add the NULL spacing. First I started on the add function. Here's what I have
Private Sub btnOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFile.Click
Dim FileName As String = ""
With dlgOpenFile
.InitialDirectory = "C:\Stuff\Office2K3.SP2"
.Filter = "All Files|*.*"
End With
If (dlgOpenFile.ShowDialog = Windows.Forms.DialogResult.OK) Then
FileName = dlgOpenFile.FileName
'Dim sr As System.IO.StreamReader = Nothing
'sr = New System.IO.StreamReader(FileName)
'CurrentFileContents = sr.ReadToEnd
Dim fs As System.IO.FileStream = New System.IO.FileStream(FileName, IO.FileMode.Open, IO.FileAccess.Read)
Dim strLength As Integer = Convert.ToInt32(fs.Length)
Dim fileData As Byte() = New Byte(strLength) {}
fs.Read(fileData, 0, strLength)
fs.Flush()
fs.Close()
For Each x As Byte In fileData
txtOut.Text &= Convert.ToChar(x) & Chr(&H0)
Next x
'For Each x As Char In CurrentFileContents
'txtOut.Text &= x & vbNullChar
'Next x
'sr.Close()
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If (CurrentFileContents = "") Then
btnOpenFile_Click(sender, e)
End If
Dim null As String = vbNullChar
Dim newFile As String = ""
For Each x As Char In CurrentFileContents
newFile &= x & CStr(vbNullChar)
Next x
txtOut.Text = newFile
End Sub
I've tried 2 different ways. I tried using a streamreader and dumping the file into a string. Then iterate with a for each loop and append a NULL char after each value. This results in a string with 1 Char in it, the first one "C". If I remove the NULL char, the string will be complete.
The other method was using a byte array. This resulted in a dump but without the NULL bytes.
I've researched and there is alot of "NULL removal" or "MYSQL and NULL in DateField" but I see nothing on NULL padding. Any takers????
|
|
|
|
|
It looks like you have a unicode file, not an ascii one... I am sure, armed with this knowledge, google will help you out more than I can
|
|
|
|
|
The file is using a different encoding than ASCII, most likely Unicode. Change the StreamReader line to this to have it try and determine the encoding automatically:
Dim sr As New StreamReader(filename, True)
|
|
|
|