|
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
|
|
|
|
|
"Concatenating" won't do much good, you'll need to merge them and call one function from the other. Shouldn't be too hard if you wrote it.
|
|
|
|
|
Hello !
i have created an application in vb.net to send email , with system.net.mail. But now i want to make possible for users to select multiple attachment , to remove one or some attachment and after to send with "send" button.
Can someone give me an idea just for begin , how can i do to manage multiple attachment before send process , (add or remove attachment ...). is there any control that i can use to keep attachment just like in a true email program.
Thank you !
p.s i'm using devexpress in my application , so if there is a control that can help me ?
|
|
|
|
|
alejx wrote: But now i want to make possible for users to select multiple attachment , to remove one or some attachment and after to send with "send" button.
A listbox, with two buttons; one to add, one to remove. When adding, open a OpenFileDialog , and add the resulting path to the listbox.
When sending, iterate the paths in the listbox, and add those files to the message, one by one.
|
|
|
|
|
I would like to use the Roll Your Own MsgBox code. When I load the sln file and run, I get the message: A project with an Output Type of Class Library cannot be started directly.
I have not used Class Libraries before but want to learn. Can someone help me or direct me to a link I could read to learn more?
Thank you very much.
Carl
|
|
|
|
|
Its as it says you can't directly run a class library project.
You need to create a WinForms / WPF or ASP.NET project and reference your class library and implement what is required to run the code.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
A class library project creates a static or dynamic library, and contains classes and their associated methods and properties. In order to use these classes you need to create an executable which creates instances of the classes and calls their methods as appropriate. For a simple test of the classes you can just include them into your project.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
HELLO GUYS OF PROGRAMMER
TO ASK YUO TO ME IS HONORABLE,IF YOU WILL TO HELP ME...
TO THE POINT MY PROBLEM
1.GIVE TO ME LINK OF TUTORIAL VB.NET 2010 FREE COMPLETE
2.TO CONNENT WITH DATABASE SERVER 2008 HOW TO DO IF i MAKE MISTAKE FROM OPEN PROJECT?
|
|
|
|
|
- The subject-line doesn't tell us anything about the subject of your post
- Don't write in all-capital letters. It's considered "shouting"
- The internet is littered with free tutorials. Try the ones from MSDN[^].
|
|
|
|
|
Hi,
I am using visual studio 2008 vb.net and msexcel 2010. am continuously pass data to ms excel it will generate a xlLine Chart. It is working fine in my PC but not working in clinet pc. they also using excel 2010.
below see my code
chartPage.SetSourceData(Source:=chartRange)
chartPage.ChartType = Excel.XlChartType.xlLine
pleae help me
|
|
|
|
|
D.Manivelan wrote: It is working fine in my PC but not working in clinet pc.
That's not enough information to go on. Did your application show an error-message? What did it say?
Did you install the InterOp assemblies on the clients PC? Does the client have MS Excel 2010 installed?
|
|
|
|
|
I've been at this on/off for about a week now. I put it to the side & move onto other things and now I'm back to it.
I have a datagridview (dgvScheduleInfo). In its properties I have the "ReadOnly" set to true. I have 6 columns (0-5). The last column ("Notes") I want to make editable if someone clicks on a "Edit Notes" button. Sounds simple enough.
I've used the following code to no avail:
dgvScheduleInfo.Columns(5).ReadOnly = False
I've tried:
dgvScheduleInfo.Columns("Notes").ReadOnly = False
The code above errors out with a "Object reference not set to an instance of an object." even though when I step through the code it shows "Notes" as the name.
I've tried hard-coding a value for testing purposes:
dgvScheduleInfo.Rows(3).Cells(5).ReadOnly = False
and that hasn't worked.
And this is ultimately what I want to work:
dgvScheduleInfo.Rows(dgvScheduleInfo.CurrentRow.Index).Cells(5).ReadOnly = False
When I step through the code, I only get an error on the one I specified. Other then that though the code steps through fine but does not set the column I'm requesting to be editable.
Now yet another curveball...
If I use:
dgvScheduleInfo.ReadOnly = False
It works fine but turns ALL the cells on which I don't want. I only want the "Notes" (or column 5) to be editable.
I've changed the "EditMode" to a couple of different things as well. Nothing.
Hopefully it's something very easy I'm missing.
I haven't changed any of the properties on the datagridview control when I dropped it on my form either. Also I'm using a tableadapter and dataset to populate my datagridview.
The only code in my command button is what I've stated above.
Thanks for any help on this.
|
|
|
|
|
John Waclawski wrote: I haven't changed any of the properties on the datagridview control when I dropped it on my form either.
That's a shortcut that "generates" code in the background, and it might seem like everything works as if by magic; but as you noticed, it takes a bit more than dragging & dropping.
The update-procedure is described here[^].
Most of us will be loading data "by hand", not using the generated code from the designer.
|
|
|
|
|
Hello: I'm working on a large database project that I currently have in VBA/Access 2007 and intend to put into VB.Net/Access 2007 as I think it might be a better idea but I'm not sure. This program is for a large law case where I will be required to deploy it by sending it out on disks to various other firms across the country. I'm a bit rusty with this so I want to know the best way to handle the solution. If all these other firms don't have Access, what other type of database should I use? What is the best practice for deployment?
|
|
|
|
|
Your users do not need to have Access installed; you'll need the JET/MDAC libraries, that's what VB needs to read/write Access-databases. If you need some of the functionality from Access, you could distribute the Access Runtime[^].
I'd recommend against using Access, unless it's a single-user database. Sql Server (Express) would be a more reliable way.
|
|
|
|
|
Terrific.. Thanks so much!
|
|
|
|
|
Hello I'm a newbie at programming and I've taken on my biggest challenge and that is to communicate to my iPhone through the USB serial...I understand that the iPhone communicate via usbmuxd. I've downloaded the software and converted it to vb, but I don't know where to start as far as opening up the ports and getting the coding right. Any help would be appreciated.
|
|
|
|
|
AFAIK, there's no .NET bindings for that library.
|
|
|
|
|
hey everyone i wont to do simple document management system in vb.net 2010 and ms access database back-end. the program will have the following features,
----create folders as the database table fields.
----upload and save PDFs files to the folder in the category created above
--- retrieve the documents
fields on the table are
letter no
received from
sent to
date received
sent date
document description
document path
thank you
|
|
|
|
|
and the question would be ..... ??
|
|
|
|