|
So what?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I want to change the color of the whole Tab control along with the Tab Pages..Currently i am able to change the color of the Tab pages.For e.g if there are 2 tab pages then both the tab pages header as well as the tab pages can get color but the empty space along side the 2 tab pages dont get any color.
Plz help me out with this problem.
Thanks
Riz
|
|
|
|
|
It looks like I replied to the right person, wrong post. My answer is here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi.. everybody..
hope you can help me with this thing.
Do you have any idea, how to save a file into MS Access database using VB 2005?
Here's the simple scheme of the table
FieldName {Data Type}
--------------------------
Date {Date}
EmployeeID {Number/Integer}
Attachment {OLE Object}
--------------------------
I red the MSDN help, but still haven't any idea how to apply it into my case.
Or should i make an array of bytes stream of the file and then store it into 'Attachment' field. But then how the to read and restore/create the file back?
Thanks before..
|
|
|
|
|
I haven't done anything like this with access, but with another database I declared a column of type blob....which essentially IS an array of bytes. That way I could store any type of file (.pdf, .jpg, .gif,...) Perhaps searching for information using the keyword "blob" will help you.
Sorry i couldn't be more helpful.
|
|
|
|
|
Thanks anyway..
|
|
|
|
|
This is an image file?
Do you want to embed them in the database or create a link to them?
OLE Object fields can be set to embed or link to an image or other OLE file such as a Word document or Excel workbook.
Embedding an image (especially GIF and JPEG) will cause the size of the database to grow far beyond the size of the image files you embed and may cause the database to run much slower. Part of the reason is that Access creates a bitmap (bmp) of the image for display information purposes. Also, If users are using Access forms, they will need additional software to view images other than bitmap (.bmp) or device independent bitmap (.dib) files on a standard Windows installation.
If the OLE Object field in the database is set to 'Link' instead of 'Embed' then all you need to do is store the path to the file.
Steve
|
|
|
|
|
It will be pdf or ms office files.
I want to embed it to the database.
Here i tell you the concept we want to meet to:
We have several teams on the field. And those team will use and report the data using that database. So for this purpose, i create the replica set.
Frequently, they have to submit the pre-formated report in office(doc,xls,ppt) and pdf.
The teams report once every month. So all they have to do is just to send the database file and at HQ team will syncronize the database and send it back to the field.
I never use OLE object, so it possible to store array of byte into it?
Is it take more space?
ty
|
|
|
|
|
Wow... i just found it...
Just take a line of code to read a file into an array of bytes, and
a line for write the bytes array into a file...
ty Microsoft
|
|
|
|
|
If the column contains an array of bytes, I'm not sure Access will display the file. I think you would need code to extract the bytes to a file again.
Also, you may want to try a few examples because, as I said, embedding files in Access (especially images) increases the file size by a huge amount. THis may not be the case with an array of bites...
Steve
|
|
|
|
|
I use ReadAllBytes and WriteAllBytes built-in functions Form Systems.IO namespace.
The size is ok.
|
|
|
|
|
posted b4 but i cant seem to find the old thread
n i need help urgently >.<
tis is the code i tried to use
---------
Private Sub AddSubmitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddSubmitB.Click
Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\db.mdb"
Dim cmd As New OleDb.OleDbCommand
Dim con As OleDb.OleDbConnection
Dim strsql As String
con = New OleDb.OleDbConnection(strcon)
con.Open()
strsql = "Insert into member (BorrowerId, password, MemberType, Fname, Lname, Gender, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy, EnrolledDate, ExpiryDate) values ('" & StudIdTB.Text & "','" & StudPwTB.Text & "','" & UgTB.Text & "','" & StudFnTB.Text & "','" & StudLnTB.Text & "','" & StudGenderCLB.Text & "','" & StudAdd1TB.Text & "','" & StudAdd2TB.Text & "','" & StudAdd3TB.Text & "','" & StudHmTB.Text & "','" & StudHpTB.Text & "','" & StudMailTB.Text & "','" & CosCB.Text & "','" & EnrolledCB.Text & "','" & ExpiryCB.Text & "')"
cmd.Connection = con
cmd.CommandText = strsql
cmd.ExecuteNonQuery()
con.Close()
MsgBox("New Member Added!")
Me.Close()
End Sub
---------
when i tested it today, it did not work
the debugger stopped at cmd.ExecuteNonQuery
it says
OleDbException was unhandled
Syntax error in INSERT INTO statement.
i checked thru my database and the sql statements n r fine, oso tried adding square brackets
how to solve?
|
|
|
|
|
Have you check the concurency?
|
|
|
|
|
Your old post is here[^], along with my reply to it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
opps, thx
mus haf posted help at too many forums, missed out, haha
|
|
|
|
|
You have single quotes inside your double quotes. You should only include these for 'string' values. Numbers should not have single quotes. Additionally, 'Date' fields may need octothorpes (#) instead of single quotes.
Your commands are setup a little inefficiently. You should only keep a connection open for the shortest time possible. Do everything else first, then open the connection just before you execute your command, then close immediately.
Try this:
Private Sub AddSubmitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddSubmitB.Click
Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\db.mdb"
Dim con As OleDb.OleDbConnection
con = New OleDb.OleDbConnection(strcon)
Dim cmd As New OleDb.OleDbCommand
cmd.Connection = con
Dim strsql As String
strsql = "Insert into member (BorrowerId, password, MemberType, Fname, Lname, Gender, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy, EnrolledDate, ExpiryDate) values ('" & StudIdTB.Text & "','" & StudPwTB.Text & "','" & UgTB.Text & "','" & StudFnTB.Text & "','" & StudLnTB.Text & "','" & StudGenderCLB.Text & "','" & StudAdd1TB.Text & "','" & StudAdd2TB.Text & "','" & StudAdd3TB.Text & "','" & StudHmTB.Text & "','" & StudHpTB.Text & "','" & StudMailTB.Text & "','" & CosCB.Text & "','" & EnrolledCB.Text & "','" & ExpiryCB.Text & "')"
cmd.CommandText = strsql
con.Open()
cmd.ExecuteNonQuery()
con.Close()
MsgBox("New Member Added!")
Me.Close()
End Sub
I haven't changed any of strsql because you seem to think the query is ok. Only you would know that. Check the single quotes etc are legal..
For queries containing this many fields, you should be using parameter queries. Once you get used to them, you will use them all the time. They are much easier to read and you can check/set data types as you go.
Steve
|
|
|
|
|
Hi All !!
I am new to VB.NET... I want to make the characters in the text of TextBox control read only... That is, those characters should not be replaced by any other character, or can not be editable... So is there any property or method that can be implemented to the charactres/text(string) of textbox's text ??
Well, very clearly, I don't want to make the whole Textbox uneditable. I just want some part of input and moreover already set text in the textbox uneditable, as we can see as par as in MaskedTextBox, for e.g. in date format, we have "/" separator uneditable. So I just want to make the text uneditable.
Expecting the responses.
Thanks,
Prodigy201
|
|
|
|
|
my 1 i used the property table of the textbox
scroll and go find the read-only option n set it to true
|
|
|
|
|
Hi !!
Thanks for the response !
Well, I don't want to make whole textbox control as readonly, but I just want to make some part of text in the textbox readonly, i.e to make some part of the text uneditable, as we can find it in MaskedTextBox control. for e.g. "/" separator in date format (found in mask properties of MaskedTextBox) as uneditable character. So is there any property or method that can be used to make this functionality?
Expecting response
Thanks,
Prodigy201
|
|
|
|
|
There is no property in the TextBOx that will do this for you.
You'll either have to use the MaskedTextBox control to get what you want (easiest option), or create your own version of the control (much more difficult).
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You can use the KeyPress event of your textbox field to override the characters that are entered, forcing the character at a certain position in the string to be a particular character. You can also limit the number of characters enetered. The following example is for a date entry field:
With YourTextBox
If Len(.Text) >= 10 And Not e.KeyChar = ChrW(8) Then
MsgBox("Maximum number of input characters is 10!", _
MsgBoxStyle.Information, "Invalid Data Input")
Exit Sub
ElseIf Len(.Text) = 2 And Not e.KeyChar = ChrW(8) And Not e.KeyChar = ChrW(47) Then
.Text = .Text & "/"
.Select(.Text.Length, 0)
ElseIf Len(.Text) = 5 And Not e.KeyChar = ChrW(8) And Not e.KeyChar = ChrW(47) Then
.Text = .Text & "/"
.Select(.Text.Length, 0)
Else
End If
End With
I use something similar to this to validate entry on all my fields. It is used in combination with the TextChanged and Validating events. I have stripped out code for setting errorproviders etc..
Steve
|
|
|
|
|
i wanna do invoice with vb in the report.. but i only know how to show all the list of the report in it.
How do i only show the specific number according to my form choosen?
Like when user choose to see the no.1 invoice then it will show it out and print out...?
|
|
|
|
|
hie ,
i need to make a listview with a popup menu BUT i need to show the "properties" of the selected item like in explorer.Problem is with this code :
Private Sub ListView2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)<br />
<br />
If Button = vbRightButton Then<br />
'If ListView2.SelectedItem = ListView2.HitTest(x, y) Then<br />
PopupMenu mnuMyMenu, vbPopupMenuRightButton<br />
'End If<br />
End If<br />
End Sub
With the 'If ListView2.Selec.... commented i just get a popup menu no matter where i click , like white space.Also if the user cliked item1 , then right-clicked in any white space.. the popup shows up with the listview SELECTED property set to item1 i Need to show the menu ONLY if the user click an ITEM!! but then with comments removed i get a runtime error 91 , object variable or with block nt set ONLY IF I CLICK A WHITE SPACE>> if i click an ITEM EVERYTHING RUNS SMOOTHLY!!
Option 2: i found http://vb-helper.com/howto_listview_right_click_header.html[^] site , it uses a VC type procedure , i do know VC , BUT its for getting a context menu on the header of the listview. The message the programm looks for is "WM_PARENTNOTIFY" and then a "WM_RBUTTONDOWN" wParam.Now I DONT KNOW THE MESSAGE for items!!
Could some one help me HERE!!
Gideon
|
|
|
|
|
ok , this is quite embarassing .. .. all i did was add a set and everything worked!!! (yes i did declare the variable!)
anyway , heres the code so no one else makes any mistakes!
Private Sub ListView2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)<br />
If Button = 2 Then<br />
Set lst = ListView2.HitTest(x, y)<br />
If Not lst Is Nothing Then<br />
PopupMenu mnuMain, vbPopupMenuRightButton<br />
End If<br />
End If<br />
End Sub
1. Use it ONLY in the MOUSEUP event
2. I dont think vbPopupMenuRightButton makes much of a difference , i any1 knows tell me!!
3. DONT FORGET SET
Hope that helps some1
Gideon
|
|
|
|
|
I'm writing a little program just for personal use which has all my favourite programs and accessories links on it, sort of like a second taskbar if you get me.
All is going well, however now I want to make my program so its always on top, but besides that I want to make it so no other windows of any other program are going behind it. E.g How all program windows stop where the taskbar starts, they dont go behind the actual taskbar. My program loads on the right side of my screen, just like the new vista sidebar does, or google desktop sidebar. Any ideas as how I can achieve this?
If I havent explained correctly myself please let me know.
In a nutshell, I want other programs running to 'bud up' to the side of my 'sidebar', instead of just going completely behind it while it is always on top.
Regards,
litestep23.
|
|
|
|
|