Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all 21866 articles
Browse latest View live

How to Bold a particular cell

$
0
0
Hi

I have written this but it's not working

flxgd.CellFontBold = True
flxgd.TextMatrix(flxgd.Row, 3) = "Quantity"
flxgd.CellFontBold = False

Thanks

Convert C# code to Visual Basic 6 - multiple Keyboards

$
0
0
I'm not familiar with C#....but found the attached program written in that language to recognize multiple keyboards using APIs. Anyone out there able to convert this to VB6 (or give me some clue on how to do it myself)? Thanks in advance.
Attached Files

rs.open (Select* from general) error

$
0
0
Hai every body

Code:

rs.Open "Select * from general", db, 3, 3
while in execution it gives below error

syntax error in FROM clause

what wrong in my code?

The Table general is imported from excel to MS Access before attach to vb6 form

Thanks in advance

Another Word mail merge question - HELP!!!

$
0
0
I am trying to do a Mail Merge from Word with VB6. I may have this wrong but in the code below I am calling a Select statement from MS SQL. I then have some code I found for Word and Mail Merge. Can I assign a DataSource property from my Select statement like I did below? Then what do I do to run the mail merge after the datasource property? Suppose I have the .doc file called BCards.doc becuase it is for a business card template that I added fields to. I am really stuck here! I looked at a ton of examples but I can't find one where I need to fill field names for a word .doc file that has the field names already in it. Thanks ahead for your help!!

Code:

  strSQL = "SELECT statement goes here"
     
        rs.Open strSQL, cnnSqlSrvr, adOpenDynamic, adLockOptimistic
     
        If Not rs.BOF And Not rs.EOF Then
     
            Set Adodc1.Recordset = rs
           
            Dim oApp As Word.Application
            Dim oDoc As Word.Document
           
            'Start a new document in Word
            Set oApp = CreateObject("Word.Application")
            Set oDoc = oApp.Documents.Add
           
            With oDoc.MailMerge
                  .DataSource = Adodc1.Recordset

What else goes here?
I have a .DOC file with the fields added already in a template
I do not want to add fields through the code
How can I use the template file to load the data into?
           
            End With
      End If

VB6 Program on Win7 32bit machine Run time error msg 0

$
0
0
Hello,

I am getting error msg of 0 (err.number) when i run my VB6 program on WIN 7 (32bit) machine. The line that generates the error is frmMain.Show

Any suggestions in troubleshooting and fixing this issue?

The program is run as Administrator

Regards

VB6 Critical Process

$
0
0
hi..
i create server-client (employee) monitoring software..i want to protect client app process,so the user cant kill the process,like when we try to kill Antivirus process through taskmanager,its show "access denied".
i've tried this code:
Quote:

'Native api NtSetInformationProcess by SqUeEzEr
Option Explicit
Private Const ANYSIZE_ARRAY = 1
Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2

Private Type LUID
LowPart As Long
HighPart As Long
End Type
Private Type LUID_AND_ATTRIBUTES
pLuid As LUID
Attributes As Long
End Type
Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
End Type


Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLUID As LUID) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long


Public Const SE_CREATE_TOKEN_NAME As String = "SeCreateTokenPrivilege"
Public Const SE_ASSIGNPRIMARYTOKEN_NAME As String = "SeAssignPrimaryTokenPrivilege"
Public Const SE_LOCK_MEMORY_NAME As String = "SeLockMemoryPrivilege"
Public Const SE_INCREASE_QUOTA_NAME As String = "SeIncreaseQuotaPrivilege"
Public Const SE_UNSOLICITED_INPUT_NAME As String = "SeUnsolicitedInputPrivilege"
Public Const SE_MACHINE_ACCOUNT_NAME As String = "SeMachineAccountPrivilege"
Public Const SE_TCB_NAME As String = "SeTcbPrivilege"
Public Const SE_SECURITY_NAME As String = "SeSecurityPrivilege"
Public Const SE_TAKE_OWNERSHIP_NAME As String = "SeTakeOwnershipPrivilege"
Public Const SE_LOAD_DRIVER_NAME As String = "SeLoadDriverPrivilege"
Public Const SE_SYSTEM_PROFILE_NAME As String = "SeSystemProfilePrivilege"
Public Const SE_SYSTEMTIME_NAME As String = "SeSystemtimePrivilege"
Public Const SE_PROF_SINGLE_PROCESS_NAME As String = "SeProfileSingleProcessPrivilege"
Public Const SE_INC_BASE_PRIORITY_NAME As String = "SeIncreaseBasePriorityPrivilege"
Public Const SE_CREATE_PAGEFILE_NAME As String = "SeCreatePagefilePrivilege"
Public Const SE_CREATE_PERMANENT_NAME As String = "SeCreatePermanentPrivilege"
Public Const SE_BACKUP_NAME As String = "SeBackupPrivilege"
Public Const SE_RESTORE_NAME As String = "SeRestorePrivilege"
Public Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege"
Public Const SE_DEBUG_NAME As String = "SeDebugPrivilege"
Public Const SE_AUDIT_NAME As String = "SeAuditPrivilege"
Public Const SE_SYSTEM_ENVIRONMENT_NAME As String = "SeSystemEnvironmentPrivilege"
Public Const SE_CHANGE_NOTIFY_NAME As String = "SeChangeNotifyPrivilege"
Public Const SE_REMOTE_SHUTDOWN_NAME As String = "SeRemoteShutdownPrivilege"
'THE api we need!
Private Declare Function NtSetInformationProcess Lib "ntdll.dll" (ByVal hProcess As Integer, ByVal ProcessInformationClass As Integer, ByVal ProcessInformation As Long, ByVal ProcessInformationLength As Integer) As Integer
Private Const ProcessBreakOnTermination As Long = 29
'The api we need!
Public Function MakeCritical(Phandle As Long, Value As Boolean)
GetPrivilegs SE_DEBUG_NAME
Dim ProcessInfo As Long

If Value = True Then
ProcessInfo = 29&
Else
ProcessInfo = 0&
End If

Call NtSetInformationProcess(Phandle, ProcessBreakOnTermination, VarPtr(ProcessInfo), Len(ProcessInfo))
End Function
Public Function GetPrivilegs(ByVal privilegio As String) As Long

Dim lpLUID As LUID
Dim lpToken As TOKEN_PRIVILEGES
Dim lpAntToken As TOKEN_PRIVILEGES
Dim hToken As Long
Dim hProcess As Long
Dim res As Long

hProcess = GetCurrentProcess()
res = OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hToken)
If res = 0 Then
Exit Function
End If
res = LookupPrivilegeValue(vbNullString, privilegio, lpLUID)
If res = 0 Then
Exit Function
End If
With lpToken
.PrivilegeCount = 1
.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
.Privileges(0).pLuid = lpLUID
End With

res = AdjustTokenPrivileges(hToken, False, lpToken, Len(lpToken), lpAntToken, Len(lpAntToken))
If res = 0 Then
Exit Function
End If
GetPrivilegs = res
End Function
and i called it with
Quote:

MakeCritical(clng(text1.text), True) 'note: text1.text is contained the current process ID
when i call "MakeCritcal",nothing happens,the process is able to killed normally through task manager..anyone please help me to figure out whats wrong this code above?

edit entire data in a field in access

$
0
0
hai everbody

i create a table with a list books supplied by rrrlf
name of the table is accreg
i have a field name is AccNo
field has 25000 entries
every start from letters RR i.e., RR123,RR456,RR589...

now i wish to rename the table as rrrlf
i wish to edit the 25000 entries as i.e., 123,456,589...
(removing RR from all entries)

kindly suggest me how to edit the field as above at database level

thanks in advance

Notification Type Utility

$
0
0
Hi

I want list of those P.O whose manufactured date has exceeded System Date , though i have created report for this . Can we create Notification like utility that is displayed on Windows Toolbar .

Thanks

vsFlexgrid Cell Height

$
0
0
Hi All

Im using vsFlexgrid 8 to build an appointments application and i have times in 15 minute increments in the first fixed column. So if an appointment lasts an hour i need to extend a cells height to cover 4 rows, does anyone know if this is possible. i can set the RowHeight property but that will do it for the entire row, but i would like to do it just with one cell.

Many Thanks
AJ

VB6 integration of IP Camera

$
0
0
hi guys! i just bought a AVN314/304 Network Camera to use in my surveillance project which will be written in VB6. i got the SDK but the samples given there are in C#. does anyone know how to integrate it with VB6? Please give me a starting point guys. What will I do first? Hope I can get a response from you guys.

Copy tables from SQL Server Database to Access Database

$
0
0
hello guys, ive got this problem to figure out

i need to copy all the tables and the content of them from a SQL Server Database to an ACCESS database.

using the "SELECT * INTO <tableName> IN '<ACCESSdbPath>' FROM <tableName>" query from the SQL Server connection doesnt work

using the same query from ACCESS to ACCESS work properly and all the tables are copied into the <ACCESSdbPath> database without any issue...

surfing the web i didnt get whether what im doing is possible or not between sql server and access so i rather know your opinion about this.

thank you very much

punch clock in access with listview

$
0
0
hello everyone
i need some help
im trying to make a punch clock to save in access with listview
i did some code to save it into richtextbox.
the problem is that im trying to save it to access but i dont know where to begin.
this is the code that i put.
Dim howmanybuttons As Integer
Dim last As String
Private Sub Command1_Click(Index As Integer)
theindex = Index
If last = theindex Then
startorclose = "Close"
last = "89"
Else
startorclose = "Start"
last = theindex
End If
a = " " & startorclose & "__" & Command1(theindex).Caption & "__" & Time & Date
b = Len(a)
b = 25 - b
If b < 1 Then GoTo 34
For i = 1 To b + 5
a = a & " "
Next i
34
Form2.LOG.Text = Form2.LOG.Text & a
End Sub

Private Sub Form_Load()
Form2.Show
End Sub

Private Sub LOG_Click(Index As Integer)
Open "C:\windows\desktop\log.txt" For Output As #1
Write #1, Form2.LOG.Text
Close #1
End Sub

Private Sub newone_Click()
If howmanybuttons = 10 Then
MsgBox ("To Many Buttons")
End If
howmanybuttons = howmanybuttons + 1
Command1(howmanybuttons).Caption = InputBox("What Do You Want The Caption To Say")
If howmanybuttons = 1 Then
Command1(1).Left = 120
Command1(1).Top = 120
End If
If howmanybuttons = 2 Then
Command1(2).Left = 2040
Command1(2).Top = 120
End If
If howmanybuttons = 3 Then
Command1(3).Left = 3960
Command1(3).Top = 120
End If
If howmanybuttons = 4 Then
Command1(4).Left = 5880
Command1(4).Top = 120
End If
If howmanybuttons = 5 Then
Command1(5).Left = 7800
Command1(5).Top = 120
End If
If howmanybuttons = 6 Then
Command1(6).Left = 120
Command1(6).Top = 720
End If
If howmanybuttons = 7 Then
Command1(7).Left = 2040
Command1(7).Top = 720
End If
If howmanybuttons = 8 Then
Command1(8).Left = 3960
Command1(8).Top = 720
End If
If howmanybuttons = 9 Then
Command1(9).Left = 5880
Command1(9).Top = 720
End If
If howmanybuttons = 10 Then
Command1(10).Left = 7800
Command1(10).Top = 720
End If
End Sub

Private Sub quitpulldown_Click()
End
End Sub

Private Sub Timer1_Timer()

End Sub
any suggestions i appreciate it

Picture1.Picture vs Picture1.Image

$
0
0
I have a picture loaded into Picture1. I have Picture1.AutoSize = False. If I use the .Picture property when transfering the picture to another Picturebox using GDI+ I get get the full size of the Picture eventhough Picture1.AutoSize = False and the overall size of the Picture1 control is much smaller that the picture in it. Now if I use the .Image to do the same thing I only get what is actually seen in the small size of the Picture1 control.

Can someone explain this to me.

block internet access

$
0
0
Hello
I want to block users from accessing my network and every time I had to remove restrictions.Please help me
Thanks.

what is the logonserver and connectionproperties code for vb6 and crystal reports?

$
0
0
Hi. I am trying to open/view the crystal reports version 10 with visual basic 6 and mysql as database. I do not know what is the exact or proper code.
What I have is the following:

crxReport.Database.LogOnServer "crdb_odbc.dll", "localhost", "dbname", "username", "password" but error Logon failed [Microsoft ][ODBC Driver Manager] Data source name not found and no default driver specified.

So I would like to ask what is the right DLL name to use? Or what is the properly syntax for logonserver?

How to stop image flickering

$
0
0
Hello

Please tell me what to do about stop image flickering in attach files.

Thank you.
Attached Files

IDE Addin menu's enabled during running?

$
0
0
Is there any way to have the menu's of an addin be enabled during running of an project? Now the addin menu is only available (as in Enabled) if you aren't running a project, but if you're debugging the options are disabled even though Addin functionalities are working if they are connected to a keybinding.
for example, I've replaced the Windows menu with our own version which is split into categories (tools/forms/code windows) and alfabetically sorted instead of last opened. It all works great when I'm not running a project, but as soon as I start running a project and hit a debug-breakpoint the menu is disabled..
Or is there are way to detect when the project is being started (so I can make the original menu visible) and when stopped (so I can make the original menu invisible again)..

Adding Icons to Popup Menu and Toolbar Button Menus

$
0
0
Hi Guys

I am able to add icons to the main toolbar via GetMenu and

hSubMenu = GetSubMenu(hMenu, 0)

ret = SetMenuItemBitmaps(hSubMenu, 0, MF_BYPOSITION, iconMenus.ListImages("CARROT").Picture, 0)

API calls.

Does anybody know how to add the same to context/popup menus that are specified in the menu editor and then shown with PopupMenu()?

And also button menu's that are created in the toolbar properties window?

Many Thanks In Advance

Jwal

visual basic 6 webbrowser string replacement help

$
0
0
howdy all am jemma nice to meet you all this forum is awsome.

i need help with something please i am kind of desperate right now


Quote:

<SPAN class=required>*</SPAN></LABEL> <INPUT class=input value=example@yahoo.com name=violatorid> </FIELDSET> </TD></TR>

how do i change the yahoo id on wb_BeforeNavigate2 event ? please help i want a code so i can replace that before webbrowser loads thanks.:mad:

[RESOLVED] Creating Multiple Rows of Command Buttons at runtime

$
0
0
Okay, now I need some help.....I have been working on this for a full day...tried dozens of loops and ifs. Just CAN'T get the logic down.

What I want is rows of command buttons on a form....maybe 25 or so (for a game similar to Jeopardy).

I determine how many buttons go in a row by using form and button widths
I decide in advance how many buttons I want so determining number of rows is easy.

Now, what I can't seem to do is move down each set of buttons into rows.
Should look similar to this:

CMD1 CMD2 CMD3 CMD4 CMD5
CMD6 CMD7 CMD8 CMD9 CMD10
CMD11 CMD12 CMD13 CMD14 CMD15...well, you get the idea.

Here is my last/final failure----and I tried many...can anyone assist here?

Code:

Option Explicit

Private Sub Command2_Click()
Dim numCmdBtnsWanted As Integer
Dim numCmdBtnsAllowedInRow As Integer
Dim numRows As Integer
Dim z As Integer
numCmdBtnsAllowedInRow = Form1.Width / Command1(0).Width
numCmdBtnsWanted = 25
numRows = numCmdBtnsWanted / numCmdBtnsAllowedInRow
Dim x As Integer
Dim y As Integer
Dim wd As Integer
wd = Command1(0).Width
Dim ht As Integer
ht = Command1(0).Height
For x = 1 To numCmdBtnsWanted
  Load Command1(x)
  Command1(x).Caption = "CMD" & Str(x)
  Command1(x).Visible = True
Next x
For x = 1 To numCmdBtnsAllowedInRow
    Command1(x).Top = Command1(0).Top
    Command1(x).Left = Command1(x - 1).Left + wd
Next x

End Sub

Viewing all 21866 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>