VB6DataGrid

xiaoxiao2021-03-06  66

How to detect the focus of dbgrid movement and movement focus

You can place the code in the RowColchange event and find that the user moves to the second column.

Provide a corresponding choice. Of course, you can refer to QA000168 "how to do in DBGRID controls

Use the drop-down list box "You can use Selendcol, SELSTARTCOL, Selendrow, and

The SELSTARTROW property is changed to change the currently selected unit.

Two views of DBGRID and transactions: (1) DBGRID is directly recorded, due to its own restrictions (lack of necessary

Detection, such as cell detection, therefore need to do a lot of control itself. It is recommended to consider other parties

law. (2) The process of transaction. When the amount of data is large, the process saved will be simplified as possible.

Then set on the transaction, which will greatly speed up the efficiency of the preservation. Use VB6 as an example.

ADO, SQL7, for example, generate a table process, can return an empty result set from the server: "Select * from table1 where 1 = 0" then is the ON Error Goto Errhandle ... Begintrans AddNew field assignment process ... Update CommitTrans ... EXIT SUB ERRHRHANDLE: ROLLBACK is bound to the Data control, the transaction is best followed by saving, not at certain

There is no problem in the function of the saved function in a function, so there will be no problem when "Data1.refresh"

. Above comments are for reference only.

Use the DataGrid control, how to use the Enter key to move the cursor between cells

Private sub DataGrid1_keyup (Keycode As INTEGER, SHIFT AS

IFR) IF Keycode = 13 Then SendKeys "{down}" end if End Sub

How to modify the column header of DBGRID

You can use the SELECT statement to specify a title, such as: SELECT F1 AS [Name] from DB but this method has a problem, because VB believes that the database will become

Read only. A better way is to use dbgrid's column caution, such as DBGRID1.COLUMNS (1) .caption = "Name"

How to add data to non-bound DBGRID

If you want to make the end user to add data, you can set the AllowAddNew property to true.

In this way, a blank line will appear on the last line of the table, and the user can add data here.

. If you want to modify the number of rows in the program, you can use the refresh method, so

DBGRID Control Abandon Current Data and Recall the UNBoundReadData Event Read Data

It can be added to the data. You can download DBGRID at http://www.componentone.com/dbgrid/

Survival Kit, including 10 examples, of which TUTORIAL 7 is how to make

Use non-binding mode.

How to disable split DataGrid

Method 1: (Not recommended) DataGrid1.Recordselectors = false method 2: Set or program the member of the DataGrid itself (method properties), seems to be no ban

Split! For a new idea: add a control to the split label of the lower left corner of DataGrid! Practice prove label, image is not (old in the bottom), but command, Picture can! Picture to put the COMMAND effect (very Good)! It is best to add a sentence: command1.tabstop = false supplement prepared the following process: Public Sub DisableDataGridsplit (DataGridx As DataGrid, Commandx As Commandbutton) DataGrid1.Scrollbars = DBGBOTH 'It is best to add this sentence, one

Yi, 'Otherwise, DataGrid1_colresize, etc.,' Control Command's Visible property commandx.Height = 270 Commandx.Move DataGridx.Left 10, DataGridx.top

DataGridx.height - Commandx.height, 30 commandx.tabstop = True End Sub Huaidai's comments: This problem is relatively blurred, but there are two for DataGrid Split: Split: DataGrid1.splits.Add (0) Remove: DataGrid1. Splits.remove (0) Please see help!

How can I fix a few columns of DBGRID?

DBGRID also has the function of locking columns, just usually weird. DBGRID can be used

The SPLIT object divides a table into two exact same parts. We can put the left

One display only a few fixed columns, while the one of the right shows the remaining columns. Below is a small

example. Private Sub Form_Load () 'Hide All Column in Splits (1) Except for Columns 0

And 1 Data1.refresh DBGRID1.SPLITS.ADD 0 DIM COLS As Column Set Cols = DBGRID1.SPLITS (0) .COLUMNS for Each C in Cols C.Visible = False Next C Cols (0) .visible = True Cols (1) .Visible = true 'configure splits (1) To Display Exactly Two Columns,

AND 'Disable Resizing with dbgrid1.splits (0) .sizemode = dbgnumberofcolumns .size = 2. allowsizing = false endh' set columns 0 and 1 invisible in other splits (splits

0 and 2) set cols = dbgrid1.splits (1) .columns cols (0) .visible = false cols (1) .visible = false end sub

DBGRID: How do you know which users choose?

You can get all selected rows using the SELBOOKMARKS collection, such as: do while dbgrid1.selbookmarks.count <> 0 data1.recordset.bookmark = dbgrid1.selbookmarks (0) print data1.recordset (0) loop How to make part of the unit merge Part of the incompatibility

Usage: VB6.0 Windows Me I need it now .TextMatrix (6, 3) and .TextMatrix (6, 4) do not merge

Just merge .TextMatrix (6, 1) and .TextMatrix (6, 2). Press the following code

(6, 1) and (6, 2) merge, (6, 3) and (6, 4) also merge, code as follows: Public Sub HJDX (Byval Msfgrid As MsflexGrid) with msfgrid .mergecells = flexmergerestrics.mergerow ( 6) = True 'The same value of the same value, but does not merge. .TextMatrix (6, 3) = jf .TextMatrix (6, 4) = jf 'lower two grids, merge. .TextMatrix (6, 1) = "Capital Amount:" & chmoney (.texTmatrix)

(6, 3)) .TextMatrix (6, 2) = "Capital Amount:" & Chmoney (.texTmatrix)

(6, 3)) End with end sub

Reply:

You can do this: .textMatrix (6, 3) = jf .textMatrix (6, 4) = jf "" Because MSFLEXGRID strictly compares whether the string is the same, more

The space is different, but it is still the same.

Boolean How to DBGRID Table Displayed as checkbox

Can set dbgrid1.columns (1) .Numberformat

For "Yes / NO", "True / false" or "on / off", which is better than the display is 0 and -1.

If you want to display as a check box, you can refer to QA000168 "how to make it in the dbgrid control.

The method of dropping the list box ", but it is more troublesome. You can also purchase commercial controls, such as:

True DBGRID (http://www.componentone.com/) or farpoint

Spread (http://www.fpoint.com/).

How to use DBGRID with ADO under VB6

Since ADO and DAO have a big difference, the data controls displayed in the ranks have two data.

The library is not compatible, that is, DBGRID can only be used with Data controls and RDO controls.

The DataGrid control can only be used with ADO. You can use the DataGrid control

The DataSource property is specified as an ADO's Recordset.

DataGrid is selected in a few lines, press the DELETE button from deleting from the database

You can add a string array, or other controls that can be added continuously. List

The control is an example. If the DataGrid's DataSource is the AdodC control, only

To add list1.additem adodc1.fields ("iTEM) in the ADODC control, if you are using an ADO code, you need to add it before the defined Recordset variable. Example: DIM WITHEVENTS RST AS Recordset

When RichtextBox runs in Win98, the display is all in the old version of the old version of Foxmail 2.x and friendship. 4.0 exists. The reason is that the Riched32.dll file of the Win9x system may be replaced with a non-Chinese version. The recommended solution is to copy the windows / system directory using the Windows 2000 Chinese version of the Riched32.dll and Riched20.dll. How to enter and control the input and control of the data in RichTextBox This problem is what I mention it, you can use characters to decrease to implement the upper and down-term function. The following program is in the form of a subscript and subscript in the RichTextBox control, mainly in the size of the character, and the position is floating up and down. The program utilizes the attribute SELCHAROFSET, which determines that the text in the RichTextBox control appears on the baseline (normal state), when Selcharoffset> 0, the text appears above the baseline, becoming the form of a marked; when Selcharoffset <0, the text appears in the text Under the baseline, it becomes a subscript form. This attribute is invalid when designing. Add the following code to the form Load event: Private Sub Form_Load () RichTextBox1.Font.Name = "Times New Roman" RichTextBox1.Font.Size = 10 RichTextBox1.Text = "H2SO4" "Move the numbers down 2 points OffsetRichText RichTextBox1. , 1, 1, 2 OffsetRichText RichTextBox1, 4, 1, -2 End Sub Private Sub OffsetRichText (box as RichTextBox, start as Integer, length as Integer, offset as Integer) "box RichTextBox control means; start means vertically as the subject of" character The starting position; Length refers to the length of the upper and lower marking characters; "OFFSET refers to the subscript or the subscript, it is greater than 0, less than 0 subscript. box.SelStart = start box.SelLength = length box.SelFontSize = box.Font.Size -abs (offset) box.SelCharOffset = ScaleY (offset, vbPoints, vbTwips) box.SelStart = 0 box.SelLength = 0 End Sub above procedure Pass in Windows98 / ME.

The second problem inserted into the JPG format in the RichTextBox control is relatively simple. You can use the following statement: 1, richtextbox1.oleObjects.add,, "equation.3" (Equation 3.0, version number can be changed ) Insert an empty formula and display formula editor; 2, or use the formula in Word or other files, "copy", and then paste with Ctrl V key in a certain location of RichtextBox. About the first question: RichTextBox There are three ways: 1, drag and drop: This object will be displayed as a file name in RichTextbox, the BMP image is no exception, but its icon is a thumbnail of its own; 2, RichtextBox1.oleObjects.add mode: richtextbox1.oleObjects.add, "file name", or richtextbox1.oleObjects.add,, "Object Type" If the file founder or class allows the site in OLE parent, editing (such as Excel, Word and formulas, then display content directly in RichTextBox; otherwise the icon is displayed. Various images are not allowed to edit on-site. 3, clipboard mode: You can display content directly in Richtextbox. The method is to open a file with other programs, "copy", and then paste with Ctrl V key in a certain location of RichTextBox. Opening the image can be used with a brush, ACDSEE, Photoshop, etc.). So displaying JPG images in RichTextBox can only use the third way. ANSHAODONG: You don't have to use other programs to open the JPG file, directly in this program to get the file name in this program, send its images to the clipboard, and then paste it with the SendKeys statement. CommonDialog1.ShowOpen Clipboard.SetData LoadPicture (CommonDialog1.FileName) RichTextBox1.SetFocus SendKeys "^ v", True 'simulated keyboard input (Ctrl v), to send the PUSH message to the active window how the image to the clipboard Paste Rich textbox in Question: I want to paste the picture of the paste board into the Rich TextBox, but there is no PASTE attribute, richtextbox1.text = clipboard.gettext can get the text of the pasteboard, with richtextbox1.text = clipboard.getText.getdata () is not Go to the picture, get a string of numbers, why? How can I solve it? Thank you! Level: Intermediate

Reply:

Can do this: '************************** Private Sub cmdpaste_click () richtextbox1.setfocus sendKeys "^ v" end sub) *******************************

How to implement "Undo" function in Richtextbox, not only applies to RichTextBox, but also for TextBox. First adding the following definitions: Const EM_CANUNDO = & HC6 Private Declare Function SendMessage Lib "User32" Alias ​​_ "SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Const EM_UNDO = & HC7 then uses SendMessage RichtextBox1.hWnd, EM_UNDO, 0 &, 0 &, can implement UNDO functionality. You can also use LRET = SendMessage (RichTextBox1.hWnd, EM_CANUNDO, 0 &, 0 &, 0 &, 0 &) to determine if Undo operations can be performed. If it is returned to 1 means. How to save the contents of RichText to the Access database, you can get RTF strings, including fonts, and the like. Generally, the fields of the RTF content are MEMO, you can use getchunk to read the MEMO field, and write the MEMO field using Appendchunk. Windows clipboard 1, please remember, Clipboard refers to the Windows clipboard, the most commonly used operation of the clipboard is the copy and paste of the selected text. Copy: clipboard.settext text box name .selText

Paste: Text box name .selText = Clipboard.getText

2, Multiline Attributes When True, the PassWrodChar attribute of text box control does not work.

3. If you want to let the content of the text box automatically wrap, just cancel the horizontal scroll bar of the text box.

转载请注明原文地址:https://www.9cbs.com/read-82217.html

New Post(0)