|
How do you make your program run other executable programs, i have tried open but it doesn't work. I tried to structure a process, but am not sure how to do it properly.
I am using Visual Basic 2005 Express Edition (Version 8). The executable is called "Install.exe" but the method i used to locate it holds it in a sttring called objFile.
Thankyou in advance.
Posted by The ANZAC
|
|
|
|
|
Call Process.Start(...) method. For more info, check this[^] out.
Best,
Jun
|
|
|
|
|
Thankyou
Posted by The ANZAC
|
|
|
|
|
|
hi all
i am designing a paintbrush i am stuck on combobox i am using a combobox fill with images as a texture i already add all images in combobox as a texture but now i want to implement images as a texture so i need help how to implement selected image/texture on my second image or painting give me some idea
syed imran azmat
|
|
|
|
|
Hi, to all
I am trying to retrieve HDD serialnumber.
I is fairly done in DiskID32 (just google it if you do not know what DiskID32 is) with differet methods.
I am trying to simulate same functionality in VB.
I am not doing anything new just trying to convert DiskID32 to VB.
I have written lot of code but stuck with DeviceIOControl.
There are two functions
1. ReadPhysicalDriveInNTWithZeroRights
- to read HDD SN without admin rights
In this function DeviceIOControl fail with errorcode 1306
i.e. "Indicates two revision levels are incompatible."
2. ReadIdeDriveAsScsiDriveInNT - to read HDD from SCSI Back door
In this function DeviceIOControl fail with errorcode 87
i.e. Invalid Parameter value
Please help me to solve this problem.
Below is the source code (copy it into a form and hit F5)
'==============================================================
Option Explicit
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const FILE_ANY_ACCESS = 0
Private Const OPEN_EXISTING = 3
Private Const CREATE_NEW = 1
Private Const INVALID_HANDLE_VALUE = -1
Private Const VER_PLATFORM_WIN32_NT = 2
Private Const IDENTIFY_BUFFER_SIZE = 512
Private Const OUTPUT_DATA_SIZE = IDENTIFY_BUFFER_SIZE + 16
'IOCTL commands
Private Const DFP_GET_VERSION = &H74080
Private Const DFP_SEND_DRIVE_COMMAND = &H7C084
Private Const DFP_RECEIVE_DRIVE_DATA = &H7C088
Private Const FILE_DEVICE_SCSI = &H1B
Private Const IOCTL_SCSI_MINIPORT_IDENTIFY = ((FILE_DEVICE_SCSI * 65536) + &H501)
Private Const IOCTL_SCSI_MINIPORT = &H4D008 'see NTDDSCSI.H for definition
'Bits returned in the fCapabilities member of GETVERSIONOUTPARAMS
Private Const CAP_IDE_ID_FUNCTION = 1 'ATA ID command supported
Private Const CAP_IDE_ATAPI_ID = 2 'ATAPI ID command supported
'Valid values for the bCommandReg member of IDEREGS.
Private Const IDE_ATA_IDENTIFY = &HEC 'Returns ID sector for ATA.
Private Const IDE_ATAPI_IDENTIFY = &HA1 'Returns ID sector for ATAPI.
'GETVERSIONOUTPARAMS contains the data returned
'from the Get Driver Version function
Private Type GETVERSIONOUTPARAMS
bVersion As Byte 'Binary driver version.
bRevision As Byte 'Binary driver revision
bReserved As Byte 'Not used
bIDEDeviceMap As Byte 'Bit map of IDE devices
fCapabilities As Long 'Bit mask of driver capabilities
dwReserved(3) As Long 'For future use
End Type
'IDE registers
Private Type IDEREGS
bFeaturesReg As Byte 'Used for specifying SMART "commands"
bSectorCountReg As Byte 'IDE sector count register
bSectorNumberReg As Byte 'IDE sector number register
bCylLowReg As Byte 'IDE low order cylinder value
bCylHighReg As Byte 'IDE high order cylinder value
bDriveHeadReg As Byte 'IDE drive/head register
bCommandReg As Byte 'Actual IDE command
bReserved As Byte 'reserved for future use - must be zero
End Type
'SENDCMDINPARAMS contains the input parameters for the
'Send Command to Drive function
Private Type SENDCMDINPARAMS
cBufferSize As Long 'Buffer size in bytes
irDriveRegs As IDEREGS 'Structure with drive register values.
bDriveNumber As Byte 'Physical drive number to send command to (0,1,2,3).
bReserved(2) As Byte 'Bytes reserved
dwReserved(3) As Long 'DWORDS reserved
bBuffer() As Byte 'Input buffer.
End Type
'Status returned from driver
Private Type DRIVERSTATUS
bDriverError As Byte 'Error code from driver, or 0 if no error
bIDEStatus As Byte 'Contents of IDE Error register
'Only valid when bDriverError is SMART_IDE_ERROR
bReserved(1) As Byte
dwReserved(1) As Long
End Type
Private Type IDSECTOR
wGenConfig As Integer
wNumCyls As Integer
wReserved As Integer
wNumHeads As Integer
wBytesPerTrack As Integer
wBytesPerSector As Integer
wSectorsPerTrack As Integer
wVendorUnique(2) As Integer
sSerialNumber(19) As Byte
wBufferType As Integer
wBufferSize As Integer
wECCSize As Integer
sFirmwareRev(7) As Byte
sModelNumber(39) As Byte
wMoreVendorUnique As Integer
wDoubleWordIO As Integer
wCapabilities As Integer
wReserved1 As Integer
wPIOTiming As Integer
wDMATiming As Integer
wBS As Integer
wNumCurrentCyls As Integer
wNumCurrentHeads As Integer
wNumCurrentSectorsPerTrack As Integer
ulCurrentSectorCapacity As Long
wMultSectorStuff As Integer
ulTotalAddressableSectors As Long
wSingleWordDMA As Integer
wMultiWordDMA As Integer
bReserved(127) As Byte
End Type
'Structure returned by SMART IOCTL commands
Private Type SENDCMDOUTPARAMS
cBufferSize As Long 'Size of Buffer in bytes
DRIVERSTATUS As DRIVERSTATUS 'Driver status structure
bBuffer() As Byte 'Buffer of arbitrary length for data read from drive
End Type
Private Type SRB_IO_CONTROL
HeaderLength As Long
Signature(8) As Byte
Timeout As Long
ControlCode As Long
ReturnCode As Long
Length As Long
End Type
'Status Flags Values
Private Enum STATUS_FLAGS
PRE_FAILURE_WARRANTY = &H1
ON_LINE_COLLECTION = &H2
PERFORMANCE_ATTRIBUTE = &H4
ERROR_RATE_ATTRIBUTE = &H8
EVENT_COUNT_ATTRIBUTE = &H10
SELF_PRESERVING_ATTRIBUTE = &H20
End Enum
Private Type ATTR_DATA
AttrID As Byte
AttrName As String
AttrValue As Byte
ThresholdValue As Byte
WorstValue As Byte
StatusFlags As STATUS_FLAGS
End Type
Private Enum IDE_DRIVE_NUMBER
PRIMARY_MASTER
PRIMARY_SLAVE
SECONDARY_MASTER
SECONDARY_SLAVE
TERTIARY_MASTER
TERTIARY_SLAVE
QUARTIARY_MASTER
QUARTIARY_SLAVE
End Enum
Private Declare Function CreateFile Lib "kernel32" _
Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
lpSecurityAttributes As Any, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function DeviceIoControl Lib "kernel32" _
(ByVal hDevice As Long, _
ByVal dwIoControlCode As Long, _
lpInBuffer As Any, _
ByVal nInBufferSize As Long, _
lpOutBuffer As Any, _
ByVal nOutBufferSize As Long, _
lpBytesReturned As Long, _
lpOverlapped As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(hpvDest As Any, _
hpvSource As Any, _
ByVal cbCopy As Long)
Private Declare Function lstrcpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As String, ByVal lpString2 As String, ByVal iMaxLength As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
'============================================
'
' TO READ Serial No. with zero admin rights
'
'============================================
Private Const IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER As Long = &H2D0C10
Dim IOCTL_STORAGE_QUERY_PROPERTY As Long
Private Const METHOD_BUFFERED = 0
Private Const FILE_DEVICE_MASS_STORAGE = &H2D
Private Const IOCTL_STORAGE_BASE = FILE_DEVICE_MASS_STORAGE
'Types of queries
Private Enum STORAGE_QUERY_TYPE
PropertyStandardQuery = 0 'Retrieves the descriptor
PropertyExistsQuery = 1 'Used to test whether the descriptor is supported
PropertyMaskQuery = 2 'Used to retrieve a mask of writeable fields in the descriptor
PropertyQueryMaxDefined = 3 'use to validate the value
End Enum
'define some initial property id's
Private Enum STORAGE_PROPERTY_ID
StorageDeviceProperty = 0
StorageAdapterProperty = 1
End Enum
Private Enum STORAGE_BUS_TYPE
BusTypeUnknown = 0
BusTypeScsi
BusTypeAtapi
BusTypeAta
BusType1394
BusTypeSsa
BusTypeFibre
BusTypeUsb
BusTypeRAID
BusTypeiSCSI
BusTypeSATA
BusTypeSAS
BusTypeMaxReserved = &H7F
End Enum
'Query structure - additional parameters for specific queries can follow the header
Private Type STORAGE_PROPERTY_QUERY
PropertyId As STORAGE_PROPERTY_ID 'ID of the property being retrieved
QueryType As STORAGE_QUERY_TYPE 'Flags indicating the type of query being performed
AdditionalParameters(1) As Byte 'Space for additional parameters if necessary
End Type
'Device property descriptor - this is really just a rehash of the inquiry
'data retrieved from a scsi device
'
'This may only be retrieved from a target device. Sending this to the bus
'will result in an error
Private Type STORAGE_DEVICE_DESCRIPTOR
Version As Long
Size As Long
DeviceType As Byte
DeviceTypeModifier As Byte
RemovableMedia As Boolean
CommandQueueing As Boolean
VendorIdOffset As Long
ProductIdOffset As Long
ProductRevisionOffset As Long
SerialNumberOffset As Long
BusType As STORAGE_BUS_TYPE
RawPropertiesLength As Long
RawDeviceProperties(1) As Byte
End Type
Private Type MEDIA_SERAL_NUMBER_DATA
SerialNumberLength As Long
Result As Long
Reserved(2) As Long
SerialNumberData(1) As Byte
End Type
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Function CTL_CODE(lngDevFileSys As Long, lngFunction As Long, lngMethod As Long, lngAccess As Long) As Long
CTL_CODE = (lngDevFileSys * (2 ^ 16)) Or (lngAccess * (2 ^ 14)) Or (lngFunction * (2 ^ 2)) Or lngMethod
End Function
Private Function ReadPhysicalDriveInNTWithZeroRights() As Long
Dim drive As Integer
Dim hPhysicalDriveIOCTL As Long
Dim driveName As String
Dim lastError As Long
IOCTL_STORAGE_QUERY_PROPERTY = CTL_CODE(IOCTL_STORAGE_BASE, &H500, METHOD_BUFFERED, FILE_ANY_ACCESS)
For drive = PRIMARY_MASTER To QUARTIARY_SLAVE
driveName = "\\.\PhysicalDrive" & drive
hPhysicalDriveIOCTL = CreateFile(driveName, 0, _
FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, _
OPEN_EXISTING, 0, ByVal 0&)
'MsgBox hPhysicalDriveIOCTL
If hPhysicalDriveIOCTL <> INVALID_HANDLE_VALUE Then
Dim query As STORAGE_PROPERTY_QUERY
Dim cbBytesReturned As Long
Dim bBuffer(10000) As Byte
Dim ret As Long
Dim SDD As STORAGE_DEVICE_DESCRIPTOR
query.PropertyId = StorageDeviceProperty
query.QueryType = PropertyStandardQuery
ret = DeviceIoControl(hPhysicalDriveIOCTL, _
IOCTL_STORAGE_QUERY_PROPERTY, _
query, Len(query), _
bBuffer(0), 10001, _
cbBytesReturned, ByVal 0&)
lastError = GetLastError
If ret <> 0 Then
CopyMemory SDD, bBuffer(0), Len(SDD)
Dim SerialNumber(1000) As Byte
Dim modelNumber(1000) As Byte
lstrcpy SerialNumber(0), SDD.SerialNumberOffset
MsgBox "Serial : " & StrConv(SwapBytes(SerialNumber), vbUnicode)
Else
MsgBox driveName & " handle : " & hPhysicalDriveIOCTL & vbCrLf & "DeviceIoControl ERROR : " & lastError
End If
End If
CloseHandle hPhysicalDriveIOCTL
Next
End Function
Private Function ReadIdeDriveAsScsiDriveInNT() As Long
Dim SENDIDLENGTH As Long
Dim sOutParam As SENDCMDOUTPARAMS
Dim sINParam As SENDCMDINPARAMS
Dim counter As Integer
Dim controller As Integer
Dim drive As Integer
Dim driveName As String
Dim hScsiDriveIOCTL As Long
Dim p As SRB_IO_CONTROL
Dim buffer() As Byte
Dim dummy As Long
Dim IDSEC As IDSECTOR
Dim ret As Long
Dim lastError As Long
SENDIDLENGTH = Len(sOutParam) + IDENTIFY_BUFFER_SIZE
controller = 0
For controller = 0 To 15
driveName = "\\.\Scsi" & controller & ":"
'Try to get a handle to PhysicalDrive IOCTL, report failure
hScsiDriveIOCTL = CreateFile(driveName, _
GENERIC_READ Or GENERIC_WRITE, _
FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, _
OPEN_EXISTING, 0&, 0&)
Debug.Print driveName & " handle = " & hScsiDriveIOCTL
If hScsiDriveIOCTL <> INVALID_HANDLE_VALUE Then
drive = 0
For drive = 0 To 1
ReDim buffer(0 To LenB(p) + SENDIDLENGTH)
p.HeaderLength = LenB(p)
p.Timeout = 10000
p.Length = SENDIDLENGTH
p.ControlCode = IOCTL_SCSI_MINIPORT_IDENTIFY
'lstrcpyn p.Signature(0), "SCSIDISK", 8
p.Signature(0) = Asc("S")
p.Signature(1) = Asc("C")
p.Signature(2) = Asc("S")
p.Signature(3) = Asc("I")
p.Signature(4) = Asc("D")
p.Signature(5) = Asc("I")
p.Signature(6) = Asc("S")
p.Signature(7) = Asc("K")
p.Signature(8) = Asc(vbNullChar)
'MsgBox StrConv(p.Signature, vbUnicode)
'sINParam.irDriveRegs.bFeaturesReg = 0
'sINParam.irDriveRegs.bSectorCountReg = 1
'sINParam.irDriveRegs.bCylLowReg = 0
'sINParam.irDriveRegs.bCylHighReg = 0
'sINParam.irDriveRegs.bDriveHeadReg = &HA0
sINParam.irDriveRegs.bCommandReg = IDE_ATA_IDENTIFY
sINParam.bDriveNumber = drive
CopyMemory buffer(0), p, Len(p)
CopyMemory buffer(LenB(p)), sINParam, LenB(sINParam)
ret = DeviceIoControl(hScsiDriveIOCTL, _
IOCTL_SCSI_MINIPORT, _
buffer(0), _
LenB(p) + LenB(sINParam) - 1, _
buffer(0), _
LenB(p) + SENDIDLENGTH, _
dummy, _
ByVal 0&)
lastError = GetLastError
'ret is gettig errorcode 1306
'means "Indicates two revision levels are incompatible."
If ret <> 0 Then
CopyMemory IDSEC, buffer(LenB(p)), LenB(IDSEC)
MsgBox "Model = " & StrConv(SwapBytes(IDSEC.sModelNumber), vbUnicode)
MsgBox "SerialNumber = " & StrConv(SwapBytes(IDSEC.sSerialNumber), vbUnicode)
Else
MsgBox driveName & " handle : " & hScsiDriveIOCTL & vbCrLf & "DeviceIoControl ERROR : " & lastError
End If
Next drive
End If
Next
End Function
Private Function SwapBytes(b() As Byte) As Byte()
Dim bTemp As Byte
Dim cnt As Long
For cnt = LBound(b) To UBound(b) Step 2
bTemp = b(cnt)
b(cnt) = b(cnt + 1)
b(cnt + 1) = bTemp
Next cnt
SwapBytes = b()
End Function
Private Sub Form_Load()
MsgBox "Calling ReadPhysicalDriveInNTWithZeroRights"
ReadPhysicalDriveInNTWithZeroRights
MsgBox "Calling ReadIdeDriveAsScsiDriveInNT"
ReadIdeDriveAsScsiDriveInNT
End
End Sub
'======================================================
|
|
|
|
|
Hi,
There is a requirement to insert data into Bulk like 20,000 - 30,000 rows into database.
Description:
I have to get one number from text file,bifercate that number and from 1st 5 digit i have to find out ID from sql server 2005 table and then go for second number of that number ,find out ID from sql server 2005 table,this process happens for 4 times for that one number and i have to do same process for 20000 rows.
Once i get all those IDs into variables into vb.net from sql server 2005,i have to insert those into one physical table and than one package will run that insert those records into another table.
Here main problem i am feeling is speed issue,to process 20000 rows for getting ids and inserting back into sql server takes somuch time.
So can some body help me out which way to go to insert records into database?
thanks
montu3377
|
|
|
|
|
Could you clarify the issue of getting the number from the text file and looking up other numbers from it? Do all of the four numbers look up an id from the same table or different tables? It sounds like it might be possible to do this with a clever SQL statement, but without more information I can't help you.
Another thing, it sounds like after you get all of your data you insert all 20,000-30,000 rows individually. I think it would be faster to input all of the data into a DataTable and use a DataAdapter to update all of the rows in one step.
|
|
|
|
|
Sorry for late reply...
Let me clarify all more clear.
Could you clarify the issue of getting the number from the text file and looking up other numbers from it?
Ans: Actually i am having one text file,now there are one column which stores information like a unique number :
example: ABC1234A12B243C334 Now from this type of number i have to slip this number like ABC1234 and find that number in one table in db get the according id of that which return 1222 for that row,store this value some where,Now go to another number of same full number that is A12 and find the id from table (yeh definatly all the tables are different not from same table) then store this value somewhere and go on for this number "B243"
and find Id from another table and store value somewhere do same thing upto end of the same number (till C334).
Tables are different not same.
I have to do the same thing for 20,000-30000 rows of that text file.
If i do one by one than it takes lots of time becoz in that case i have to take like 20,000-30,000 connection on that time appication may hang up.
Once i get all the values(i.e. all the ids) need to insert into one table.
Can you pls. tell me that how to do bulk insertion??
montu3377
|
|
|
|
|
HIE,
I 'm making a address book type application and i need to add an export to word function.I want to be able to write data into a table in a word file.Is this possible and how would i go about it?? if it is possible??
I had a wierd idea .. what if i made the table in a richtextbox (i dont know how to do that~!)And then write that data into a .doc file?.
also what about just printing the table .. what do i have to look up to just make a File->Print fuction that would have the table printed!??
i really need this please , this is the third forum i've put this question on!!
PS . i need to know how to do this in VB6 code cuz.. i'm still not very clear with .NET concepts!
Thanks
Gideon
-- modified at 13:25 Friday 14th July, 2006
|
|
|
|
|
Hallo all,
first sorry for my English.
I have a problem. I build an good aplication with a form. In this i show my college some interesting details as text in an label. They only must press a button every have an hour an see the new informations. So i take this informations from an automatik create info.txt file.. I think with the filewatcher i can show it every half an hour automaticly in the lbinfo label in form1 but there come everytime this error:
Its look in German sorry .
Fehler beim Erstellen des Formulars. Weitere Informationen finden Sie in Exception.InnerException. Fehler: Für den aktuellen Thread muss der STA-Modus (Single Thread Apartment) festgelegt werden, bevor OLE-Aufrufe ausgeführt werden können. Stellen Sie sicher, dass die Hauptfunktion mit STAThreadAttribute gekennzeichnet ist .
This is my code for working:
so its easiere to understand?
Imports System.IO
Module Watchertest
Sub Run()
' Create a new FileSystemWatcher and set its properties.
Dim watcher As New FileSystemWatcher()
watcher.Path = ("c:\sms\")
' Only watch text files.
watcher.Filter = "sms.txt"
' Add event handlers.
AddHandler watcher.Created, AddressOf OnChanged
' Begin watching.
watcher.EnableRaisingEvents = True
End Sub
' Define the event handlers.
Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
' Specify what is done when a file is changed, created, or deleted.
MsgBox("File: " & e.FullPath & " " & e.ChangeType)
FrmSms.Cursor = Cursors.WaitCursor
FrmSms.TxtMis.Text = Nothing
Call Mis_Sql_connect.sql_con()
FrmSms.TxtMis.Visible = True
FrmSms.TxtMis.Text = Trim(info)
FrmSms.Cursor = Cursors.Default
End Sub
End Module
Thanks for help.
Regards Thomas
|
|
|
|
|
Sorry, but your posted message is very hard to understand. And I'm confused about your code. How is the Run() method called or by what control? What type of VB are you using? Perhaps it is my own limited knowledge, but I really don't understand the AddHandler code you are using.
Perhaps you should think about using a timer control. That way you can check the file every half hour without the user pressing a button.
For anyone else who is trying to help, I used an online translator to translate the error message to english and got this:
Error with providing the form. Further information finds you in exception inside exception. Error: For the current Thread the STA mode (single Thread apartment) must be specified, before OLE calls can be implemented. Guarantee that the main function is marked by STAThreadAttribute.
Perhaps you can use some break points/debugging methods to pin point exactly where the error is occuring.
Sorry I couldn't help you more.
|
|
|
|
|
Hallo thanks for answere. First the txt file not look every half an hour exectly so i want do this with the watcher. My vb is VB2005 netframework2.
In this Code i look for change filter on the sms.txt file. Then i have an Frmsms its look informations about the productivity of some works. I want only refresh the label in this Form and the translated message from you is correct. If the txt changed a msgbox is popup i have test it.Thats all correct by the handle but if i do refresh or do anything outside this class (frmsms.label5.refresh) or else the error is pop up..
I look to command my code and post nearly.
Thanks Thomas
|
|
|
|
|
Sorry, but this doesn't help. We still can't understand a thing you said.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi everyone,
I have this application that I need to actually restart it because I have so many things to reset and I can't identify all of them to reset them one by one. So I thought of using Application.Restart and it works but the blinking of the interface seems a little annoying.
I was thinking is there any better way to do it other than making another identical interface on top of it? So that the user would not know it is being restart.
Thanks
J Liang
|
|
|
|
|
Not really. You've got 4 options...
1) Use Application.Restart
2) Launch a new copy of your application, and probably get the same effect as #1
3) Reset everything that needs to be reset, one thing at a time.
4) Move as much data as you can, that needs to be reset, into it's own seperate class, then serialize the "just initialized" state of this class out to a file. When you need to restart, just reload the data.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
First, with a cold restart, blinking seems to be inevitable. However, it's difficult to re-initialize the running application to its startinf state without a restart. Actually, GUI is not the most difficult part; the system state is.
The approach we often adopt is save/restore or snapshot. The original idea is that during training, the trainee often want to take a snapshot and save it to a disk file. Next time, when you run the app again, you could load that snapshot and restore to the system state when the snapshot was taken. We also find the snapshot is handy when we want to re-initialize the application without restarting, which I call "hot restart". But usually, it is not trivial to implement a snapshot capability.
Best,
Jun
|
|
|
|
|
Hi
How to filter record in dataset and update those filtered records
Thanks in advance
|
|
|
|
|
'** Creat a dataview of the table in the dataset
Dim tableView As DataView = New DataView(dataSet.Tables("TableName"))
'** Filter the dataview to isolate the one row being updated
Dim sb As New StringBuilder
With sb
.Length = 0
.Append("TableColumnName")
.Append("= '")
.Append("ValueOfData")
.Append("'")
tableView.RowFilter = .ToString
End With
sb = Nothing
'** Do the update
If tableView.Count > 0 Then
'** Create a view of the row being updated
Dim tr As DataRowView
tr = tableView.Item(0)
'** Update the columns being changed
tr.Item("NameOfColumnBeingChanged") = "NewValue"
tr = Nothing
End If
tableView = Nothing
|
|
|
|
|
I have one font required in my project . which I dont want to install on the client infact it should be some where in my Resource files and I should use it from there.
Any ideas or suggestions
Regards
Rizwan Bashir
|
|
|
|
|
Hi all,
I'm having trouble editing the atrribute "member" of a group. I can extract all the information but can't add or remove anything. It's a Win2003 Server/DC, I have the rights to add/remove.
I'm using VB .net 2005
My Code:
oSearcher.Filter = "(&(objectClass=group)(cn="something..."))"
oSearcher.SearchScope = System.DirectoryServices.SearchScope.Subtree
oSearcher.PropertiesToLoad.Add("member")
oResult = oSearcher.FindOne
oResult.GetDirectoryEntry.Properties("member").Remove(something...)
oResult.GetDirectoryEntry.CommitChanges()
Is there an error in the code? What ist the better way to go: to use "Invoke" or the "Properties"? What's the difference? Is there any way to get a response if the add/remove didn't work (eg don't have the rights or wrong group name...)? I need to get this done by Monday so pleeeeeaaase help!
Regards,
Uli
-- modified at 6:27 Friday 14th July, 2006
|
|
|
|
|
I figured it out myself.
The problem was that I was trying to edit the oResult Object which doesn't work!
oResult = oSearcher.FindOne
Dim deObject as DirectoryEntry
deObject=oResult.GetDirectoryEntry
deObject.Properties("member").Remove(something...)
deObject.CommitChanges()
That's all.
Hope this helps someone.
Uli
|
|
|
|
|
hellow to all
i am trying to build my own Custom Control that Inherits from AxMSMask.AxMaskEdBox .
i wanna do simple thing i wanna have some property that when i make it ture it will run function every time that the user leave the MaskedBox it will run .
i started writing my own code , but i code stucked i didn't found good stuff anyone can help me with the following code ? , or give me links to related issues ?
Imports System.ComponentModel
Public Class MskTextBox
Inherits AxMSMask.AxMaskEdBox
Private DateStr As Boolean
Public Property DateValidator() As Boolean
Get
DateValidator = DateStr
End Get
Set(ByVal Value As Boolean)
DateStr = Value
End Set
End Property
Private Sub MskTextBox(ByVal Datestr As AxMSMask.AxMaskEdBox)
If Not IsDate(Datestr.FormattedText) Then
MessageBox.Show("error ! ")
End If
End Sub
End Class
|
|
|
|
|
Is there is specific problem you are having with your code?
|
|
|
|
|
I have developed project on VB6.0 and Database backend in SQL Server
more than 30 user are use this software in at time. They are not faced any problem the s/w working fine but as soon as the no. of user are increased we are
faced process Id problem Plz Help me
Process ID problem means There was error as dead processId of sql server
-- modified at 9:00 Friday 14th July, 2006
|
|
|
|
|