|
You don't want that... You're database will become terribly slow. Store the filename of your image instead and store the image itself on the harddrive...
|
|
|
|
|
I disagree with the other guy...I mean, he has a point. But sometimes you really do need to store an image in a db. You may just have to figure out a way to work around the slow down...so it's important to keep that in mind.
I work with VB not C#, but it's pretty close so you should be able to figure it out from what I give you. Basically, you need to turn the image file into an array of bytes. So your table should contain a blob column, or a column that will hold an array of bytes. So, your code would look something like this
Dim dt as New DataTable<br />
'Either fill dt with schema from access db or add column like below...<br />
dt.Columns.Add("ImageColumn", System.Type.GetType("System.Byte[]"))<br />
<br />
Dim strImageLocation as String = "C:\My Image.gif"<br />
If System.IO.File.Exists(strImageLocation) Then 'Make sure the image file exists<br />
Dim rowNew As DataRow = dt.NewRow<br />
rowNew("ImageColumn") = System.IO.File.ReadAllBytes(strImageLocation)<br />
dt.Rows.Add(rowNew)<br />
End If
Hope this helps.
|
|
|
|
|
Hello there,
Can anyone guide how to implement the regular cut/copy/paste functionalities in the windows forms combobox control? I am surprised to note that these are not present by default!
I have been able to implement copy and cut for the selected text, but Paste still remains an issue as I am not able to know the position on the combobox where I should paste from the clipboard.
Any help is greatly appreciated.
Thanks and regards
Atul Agarwal
|
|
|
|
|
atulagarwal56 wrote: I am surprised to note that these are not present by default!
Even I am surprised, why didnt you find that?
FYI, it is there.
|
|
|
|
|
HI,
I agree that its present. But guess I forgot to mention that I am using MDI forms and the same functionality is missing the moment you add a combobox to a child form. How do we solve this?
Thanks and regards,
ATUL
|
|
|
|
|
I'm assuming that you're using a DropDownList -style combo box, because the edit box of the DropDown style already implements cut/copy/paste.
To select a particular string, use the FindString /FindStringExact methods to find the string, and set the SelectedIndex property to the returned value to select it.
|
|
|
|
|
How do I link data bound detail fields on a form to data bound master fields? I'm using the default setup produced by dragging fields onto the form from the Data Sources window, so I have two BindingSource objects, one for detail and one for master. The two tables are linked by a relation in the DataSet.
|
|
|
|
|
Hello eveybody!
I have a small question need your help.
My datagridview is bound with a dataset contains tblProduct table. A combox allows users choose a Product(B3700, NAPPLE 3'1, NAPPLE 3'2,...)
If I filter like this tblProductBingdingSource.Filter = "Product = 'B3700'" . It works well
If I repeat tblProductBingdingSource.Filter = "Product = 'NAPPLE 3'2'" , it fails to work because of existence of the quote mark.
If I replace string "Product = 'NAPPLE 3'2'" with string "Product like 'NAPPLE 3%'" , my grid will have this list of unexpected products such as NAPPLE 3'1, NAPPEL 3'2, NAPPLE 3'3,so on.
When the users choose a value from combobox such as NAPPLE 3'2, I only have an only product, NAPPLE 3'2. Please help me correct the filtering string.
I know the filtering string "Product like 'NAPPLE 3%2'" but the string is not general for all.
Thanks in advance
Sorry about my English.
It seem to be a solution or an answer.
|
|
|
|
|
You can replace the single quote with two of them which means that it will work, so the search term would be
"Product='NAPPLE 3''2'''"
Give it a try and post back if you need any help
|
|
|
|
|
Hi
I have a text box with the following properties: Enabled=true,readonly=true.
The text box is only for reading and not for modify text.
i acomplish the above tasks but i cannot get read off the cursor in the text box.
if i use Enabled=false the cursor inside the textbox gone and cannot show in it, but the text
lose its forecolor which i can not accept it.
Please advice how i can make that cursor will not show at all in the text box
Or if we use Enabled property false how i not lossing the original forecolor of the font?
Thank in advance.
|
|
|
|
|
U can use Moucefocus propery to False.so than no mousce focus on that
textfiled..
|
|
|
|
|
Where does MouseFocus property occur mate?
|
|
|
|
|
RepliCrux wrote: Where does MouseFocus property occur mate?
It doesn't. See MSDN for a complete list of available properties[^]
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
how can i access this property.
Do you have a link or example that i can use?
Thanks
|
|
|
|
|
tomertro wrote: how can i access this property.
It doesn't exist. See MSDN for a complete list of available properties[^]
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thank you for your replay.
Tomer Trojman.
|
|
|
|
|
Catch the GotFocus event and focus another control
|
|
|
|
|
Very good idea, i try it and it's working good.
Thank you.
|
|
|
|
|
You are welcome
|
|
|
|
|
if you want to read it, you may also want to be able to copy (part of) its
contents, so having a cursor may be good.
|
|
|
|
|
thats right too, thank for your replay.
Tomer Trojman.
|
|
|
|
|
Hi All,
I am getting this error when I am adding user control in the form, Please me in solving this problem.
Thanks in advance.
|
|
|
|
|
In your user control there is a variable called emSize,
-- Either you are setting the value as 0 (and it should not be)
-- OR there is some calculation going on in the code, which is resulting the value of emSize to be 0 (which ofcourse should not be)
If that does not help, post it the usercontrol code.
Cheers.
|
|
|
|
|
No I have not use emSize variable anywhere.
The user controls is date control and code is:
Me.BackColor = g_FormBackColor
Dim obj As Object
For Each obj In Me.Controls
If TypeOf obj Is TextBox Then
obj.backcolor = g_TxtBackColor 'clrtxtbackcolor 'color.lightgray
obj.forecolor = g_TxtForeColor 'clrtxtforecolor 'color.blue
obj.font = New Font(g_strTxtFontName, g_intTxtFontSize, FontStyle.Regular) '"courier new"
'obj.borderstyle = borderstyle.fixedsingle
End If
If TypeOf obj Is Label Then
obj.font = New Font("", g_intLblFontSize, FontStyle.Bold)
End If
Next
My code is working fine if I comment this code.
Please help me...Thanks in advance...
|
|
|
|
|
Hi,
I did a quick search, looks like emSize has to do with System.Single, U are right.
don't know the exact reason why the code is falling over, but you can find a way out for sure.
may be 'obj.borderstyle = borderstyle.fixedsingle is the reason.
goodluck
|
|
|
|