|
Member 9707221 wrote: Dear Brother
I'm neither.
Member 9707221 wrote: Let me tell you this junk is displaying correct value in text box or crystal repots having font supports arabic charset. But at the time of saving in (Insert statement) textbox.text gives me this junk, How can I play with them.
Like I said, it's a dead language. If you want to use it, you'll be doing a lot of archeology.
http://blogs.msdn.com/b/vsarabic/archive/2012/04/05/install-arabic-vb6-applications.aspx[^].
|
|
|
|
|
i want to use class Win32_DefragAnalysis(WMI) to scan status of other volume, but it is not active, exactly, the For-each is not work, please help me,
<pre lang="vb">Private Sub defrag_analysis()
On Error Resume Next
Dim item
Dim nameSQL
Dim wmiOBJECT
Dim itemCOLLECTION
Set wmiOBJECT = GetObject("Winmgmts:\\.\root\cimv2")
nameSQL = "select * from Win32_DefragAnalysis" ' Where VolumeSize > 0 "
Set itemCOLLECTION = wmiOBJECT.ExecQuery(nameSQL)
For Each item In itemCOLLECTION
'not print properties of item
MsgBox "VolumeSize : " & item.VolumeSize
MsgBox "Name : " & item.VolumeName
MsgBox "FreeSpace :" & item.FreeSpace
MsgBox "AverageFileSize : " & item.AverageFileSize
Next
MsgBox "jump here"
End Sub
</pre>
|
|
|
|
|
Since when does VB6 have a "for-each"? Did I mention it's a dead language? Why are you still using it?
The VB.NET IDE is available for free, as is the runtime. I strongly suggest you switch your platform.
|
|
|
|
|
Hi, I need some help on printing data on a listview having 20 columns of data, how do i do that
|
|
|
|
|
|
code for puzzle game having 9 comand buttons using if statement
|
|
|
|
|
No one is going to just give you code. You must present what you have done so far and describe where you need assistance, then they might show you a way to solve your problem.
Good luck.
|
|
|
|
|
|
Does anyone have a code for VB program to set the time example 30 minutes could turn off the Internet (ADSL), much like internet cafes?
|
|
|
|
|
And you expect someone to just hand over their hard work for you to turn in as your own??
|
|
|
|
|
|
In that case, you'll be writing a proxy server. When a client connects to the proxy for the first time, you record the current time. Every time the client makes another request, you check the current time against the one that was recorded on first connection. Greater than 30 seconds? Don't forward the request to the destination server.
|
|
|
|
|
Cannot get instr function to work .net?
Using VB.net
For some reason, the 'instr' function and the 'string.indexof' is the same.
The problem is that one of the 2 string arguments, is a variable that is passed from the calling subroutine (not the literal characters) and it does not recognise the 'match'.
When I type in the literal characters with " " -- it works ok.
Here is a copy of the line that is not working.
'm' is the positional marker / 'largetxt' the body that is being searched and 'smalltxt' is the string that is being searched for.
intx = InStr(m, mainTxt, smallTxt)
The variable 'smallTxt' is the problem ---- if I have:
intx = InStr(m, mainTxt, "house") --- it works ok
Also ... same thing for:
intx = largeTxt.IndexOf(smallTxt, m)
Cheers
|
|
|
|
|
InStr is only there for converted VB6 code. It's been deprecated. Use string.IndexOf() instead.
Without seeing the contents of the variables, it's impossible to tell you why it isn't working with any confidence. These functions are case-sensitive, so that might be your problem, but...
|
|
|
|
|
Here is a sample for you...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim maintext As String
Dim smalltext As String
Dim foundpos As Integer
Dim startpos As Integer
startpos = 0
maintext = "Jack and Jill"
smalltext = "and"
foundpos = maintext.IndexOf(smalltext, startpos)
If foundpos > 0 Then
MsgBox("match found at character " & foundpos)
Else
MsgBox("no match found")
End If
End Sub
|
|
|
|
|
Thank you both .
It the 'indexof' function also not working .... it gives a true result may one time in 20 (when I know it is a true hit).
I think there may be a bug in vb.net. It doesn't matter what I do, it comes up with -1 all the time.
|
|
|
|
|
Is there an alternative method ?.... .... I could spend 5 years tyring to get this one working - it's driving me crazy.
|
|
|
|
|
Yes theres INSTR,
If INSTR(Look-in-this-string", "For-This-String") > 0 Then
'REM A Match Was Found
Else
'REM No_Match_Was_Found
End If
and if you assign the result to a variable then the variable will give you the position...
LocationId = INSTR(Look-in-this-string", "For-This-String")
If LocationId > 0 Then
'REM A Match Was Found
Else
'REM No_Match_Was_Found
End If
|
|
|
|
|
.NET is a widely used framework, and looking for the position in a string is something most of us do. If there was a bug, it'd be found by now.
For these types of bugs, the answer is that "SELECT is not broken".
|
|
|
|
|
Did you try the code portion i added in my thread?
I tested it and it works fine...
obviously we can see the word AND is in the string JACK AND JILL.....
It makes me wonder what the ACTUAL strings are that you are comparing.
Maybe you could add them in a thread?
Its highly unlikely that the IndexOf method/function isnot working!
Its quite possible though that your installation of the development environment may have a corrupted file and possibly the next step would be to uninstall and re-install it again.
Still though, maybe you could save some time by adding your strings which your using in the comparision or even to upload the ACTUAL code block which is causing the offence?
Also, if your searching for a single character without specifying the number of consecutive characters to search, then the character must be in UNICODE, maybe that is of relavance?
Finally IndexOf is Zero based, so the FIRST character is position 0 then increases upwards, meaning it does not start with 1 but with zero.
Looking at the string "JACK AND JILL" and searching for a match of "AND" the code block I gave you states a match is found at charcter position 5, which taking it from a zero based index is ACTUALLY chracter 6 when starting from 1...
So maybe as a last resort you could subtract one from your start point (or start at zero anyway) and look for a match you KNOW exists in your string.
|
|
|
|
|
I'll go so far as to guarantee that there is no bug in INSTR or IndexOf.
It may be a match to you, but the function is telling you otherwise.
Without seeing REAL examples of the strings you are searching and the strings you are searching for in them, it's impossible to tell you why you think they work and the computer is saying they don't.
|
|
|
|
|
Is this a "case" problem?
Try converting both strings to either all upper or all lower case:
largeTxt.tolower.IndexOf(smallTxt.tolower, m)
|
|
|
|
|
I have created a dll named myInterface.DLL that interfaces between my application and a 3rd party application. To do this I Added a reference to their Interop.3rdParty.dll and added an “Imports 3rdParty”. Everything works great. They released version 2 of the 3rd party app and added renamed their interops and name spaces. So What I am forced to do is create a new dll, myInterface_V2.DLL. This DLL is an exact copy of the myInterface.DLL with the exception of the what dll’s are referenced and the Imports directive changed to “Import CompanyName.3rdParty “ . Inside my DLL’s I have 3 forms and 2 Classes and as I stated above the only the only difference between my 2 dll’s is the “Imports” statement. So now my calling application checks to see what version of the 3rd party app the user has and calls the appropriate form in the appropriate DLL. So my question Without duplication the 3 forms and 2 classes is there a way to dynamically change the “Imports” statement, or can anyone suggest a way of doing this where I do not have so much duplicate code. I am hating the fact that every time I update the dll I have to duplicate it somewhere else. This is a vb.net dll and I am using VS2010 and a Windows 7 box.
Thanks in advance
Paul
-- modified 18-Dec-12 16:40pm.
|
|
|
|
|
You can't change the references during runtime, but you can load another assembly, load it's types and use them. Google for "reflection" and "Assembly.Load", there should be some examples out there.
|
|
|
|
|
Hello all,
I made 2 scripts under, the first for search all folders and subfolders (named "prive") in my R: Drive and the second for search security groups(begin by FR_DEPT ou LTGFR) on a folder.
I want to concatenate scripts for each "prive" folder, it could search if groups are affected.
Can you help me please?
Thanks in advance
'------------------------------------- 1er script
Option Explicit
Dim path_start
Dim subfolder
Dim Myfso, result
Set Myfso = CreateObject("Scripting.FileSystemObject")
path_start = "R:"
subfolder = "prive"
result = Find(path_start, subfolder)
Function Find (strPath, strFileName)
Dim MyDir, MyFile, MySubDir
Dim strResult
If strFileName = Empty Then Exit Function
strFileName = Ucase(strFileName)
Set MyDir = Myfso.GetFolder(strPath)
For Each MyFile In MyDir.subFolders
If Ucase(MyFile.Name) = strFileName Then strResult = strResult & strPath & "\" & MyFile.Name & vbCrLf
Next
For Each MySubDir In MyDir.SubFolders
strResult = strResult & Find(strPath & "\" & MySubDir.Name, strFileName)
Next
Find = strResult
End Function
'---------------------------------- 2eme script
strFolderName = "Le dossier prive de mon 1er script"
Const INPUT1_FILE_NAME = "c:\test1.txt"
Const FOR_READING = 1, FOR_WRITING = 2, FOR_APPEND = 8
Const OVER_WRITE_EXISTING = True
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(INPUT1_FILE_NAME, FOR_APPEND,true)
Set objWMIService = GetObject("winmgmts:")
Set objFolderSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFolderName & "'")
intRetVal = objFolderSecuritySettings.GetSecurityDescriptor(objSD)
intControlFlags = objSD.ControlFlags
arrACEs = objSD.DACL
For Each objACE in arrACEs
if Left(objACE.Trustee.Name,7) = "FR_DEPT" then
f.write(strFolderName & " ")
f.write(objACE.Trustee.Domain & "\" & objACE.Trustee.Name + VbCrLf)
WScript.Echo strFolderName
WScript.Echo objACE.Trustee.Domain & "\" & objACE.Trustee.Name
else
if Left(objACE.Trustee.Name,5) = "LTGFR" then
f.write(strFolderName & " ")
f.write(objACE.Trustee.Domain & "\" & objACE.Trustee.Name + VbCrLf)
WScript.Echo strFolderName
WScript.Echo objACE.Trustee.Domain & "\" & objACE.Trustee.Name
end if
end if
next
|
|
|
|