|
There is no wildcard character in string comparisons.
You're really confusing people when you ask questions. You said this code works as expected, but it doesn't do anything anywhere close to what you said it does.
Anyway, in a previous example that you posted, you had code in there to check if the string started with a certain substring, and in this case, that would be "BEN*JE*ZZ*". So, you'd do something like this:
If myString.StartsWith("BEN*JE*ZZ*") Then
....
|
|
|
|
|
Thanks for your input Dave. i dont mean to confuse you, but my code as posted does exactly what I need it to do, save and except the conditional values of myString. I am trying to learn and just looking for suggestions.
|
|
|
|
|
IvanIT wrote: save and except the conditional values of myString.
Well, that's kind of the important part! Don't just snip out parts of your code when you post snippets, at least not without a note saying you did so. People will look at your code and wonder what you're smoking.
|
|
|
|
|
I think there's no easy way. Since you use StringBuilder I think that one option is to convert it to string and then split by the known character sequence like:
Dim knownChars() As String = {"BEN*JE*ZZ*"}
Dim lines() As String = newString.ToString().Split(knownChars, StringSplitOptions.None)
after that you can loop through lines array and after each BEN*JE*ZZ* item, you'll add newline to the item after that at position 11.
|
|
|
|
|
I will gie this option a whirl and post the results here. Thanks again.
|
|
|
|
|
You're welcome
Hopefully it works.
|
|
|
|
|
I have already shown you how to use a regular expression to match a string using wildcards.
You are still using a StringBuilder, but you are not building any string. All that you manage to do with that is to copy all the string data one extra time.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank you Guffa. I was suffering from one of those try and try again deal that ended up confusing me (and others). You have been a great help and I am learning. Thanks
|
|
|
|
|
How to sort data in DataGridView column who contain Date/Time records I click in header column but not sort correctly
|
|
|
|
|
|
So many ways to do this: dataview, sort from DB, sort on column, etc. Pick your poison.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
but I want to sort in Datagrid column because other way I want to sort another column
|
|
|
|
|
I know not to many people participate in VBA around here, but I'll post anyways
I'm trying to assign (in excel 2003, sp3) a string to the FormulaArray property of a range. The length of the string is 305, causing a crash because it is maxed over 255 characters (the error and cause is documentated poorly at http://support.microsoft.com/kb/213181, I say poorly because at the top of the article it states
This problem occurs when you try to pass a formula that contains more than 255 characters, and you are using the FormulaArray property in Visual Basic for Applications.
with no solution.
So I ask, does anyone here have any ideas as to a solution/workaround?
Thanks for the read / effort
|
|
|
|
|
Solution available at this site.[^]
Summary
''' If the long formula can be broken into parts, where the second part can
''' be replaced by a dummy function, this approach can be used...
Public Sub LongArrayFormula()
Dim theFormulaPart1 As String
Dim theFormulaPart2 As String
theFormulaPart1 = "=IF(MONTH(DATE(YEAR(NOW()),MONTH(NOW()),1))-" & _
"MONTH(DATE(YEAR(NOW()),MONTH(NOW()),1)-" & _
"(WEEKDAY(DATE(YEAR(NOW()),MONTH(NOW()),1))-1)+" & _
"{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1),""""," & _
"X_X_X())"
theFormulaPart2 = "DATE(YEAR(NOW()),MONTH(NOW()),1)-" & _
"(WEEKDAY(DATE(YEAR(NOW()),MONTH(NOW()),1))-1)+" & _
"{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1)"
With ActiveSheet.Range("E2:K7")
.FormulaArray = theFormulaPart1
.Replace "X_X_X())", theFormulaPart2
.NumberFormat = "mmm dd"
End With
End Sub
|
|
|
|
|
Hi,
I have a VB6 app with a VB.Net Interop user control ( a menu ).
When I click some option at the interop menu, it generates an event that is handled by the VB6 app to call a VB6 form. But after the VB6 form is called the focus remains at the interop usercontrol and then I need an aditional click to put the focus at the called form.
Thanks in advance.
|
|
|
|
|
Didn't VB6 have a SetFocus method on it's controls?? I'd say start by showing your form, the call SetFocus on the control you want the focus to move to.
|
|
|
|
|
Hi,
Yes...there's a setfocus at VB6 but it don't work at this situation.
I can see that the problem is related to modal forms and not to non modal forms
The following code works ok :
Private Sub InteropEventAtVb6()
MyVb6Form2.Show
End Sub
At the following code I need an extra mouse click to focus the form...
Private Sub InteropEventAtVb6()
MyVb6Form2.Show 1
End Sub
|
|
|
|
|
In that case, I have no idea and no way to test it. I haven't used VB6 in over 7 years.
|
|
|
|
|
|
Hello All,
I have a requirements in "Windows form exe" that when we click on the exe, the data from the Oracle database should be exported to another Oracle database and also the data that has been exported should be emailed with excel attachments to intended recipents.
I searched but couldn't get the code as such and also i am not able to implement the functionality.
It would be great, if someone can help me out in this.
Many thanks.
|
|
|
|
|
Basically it's quite simple application. For example if you want to retrieve the data through the application it could be something like:
- you create a OracleConnection against source database
- you create a OracleConnection against target database
- use OracleCommand and OracleReader to read data from source
- use OracleCommand to insert data to the target
- use MailMessage class to deliver the message
However I think that a better way would be:
- create a database link in the target database pointing to the source database
- create stored procedure which copies the data from soure to target (for example using insert into ... select from ...
- after populating the target, return ref_cursor to the added rows
- return the data to the client application and send the message
This logic would use the same classes but the transfer is much easier to code and much faster.
Hope this helps,
Mika
modified on Tuesday, January 27, 2009 9:41 AM
|
|
|
|
|
You can use the following code send you excel file as an attachment from your application.
it use an smtp server,please enter proper email id as marked in the comments , i have tested it from a gmail account
Dim smtpClient As New Net.Mail.SmtpClient()
Dim mail As New Net.Mail.MailMessage()
'create the message to be sent
mail.To.Add("test@test.com") ' Enter the Email of the person you want to send the mail to
mail.From = New Net.Mail.MailAddress("username@gmail.com", "Your Display Name") ' Enter Your email address
mail.Subject = "Test Message"
mail.Body = "This is a test message"
' Prepare the client to send the above message
'Attach the file as attachment
mail.Attachments.Add(new System.Net.Mail.Attachment("yourFileName.xls"))
smtpClient.Host = "smtp.gmail.com"
smtpClient.EnableSsl = True
smtpClient.Port = 587
smtpClient.Credentials = New Net.NetworkCredential("username@gmail.com", "password") 'Enter username and password of the account , you want to use to send mail
smtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
smtpClient.Send(mail)
Hope this helps
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
This works like genius Bharat. Many thanks
|
|
|
|
|
Hi,
I'm using cr 8.5 and vb6. I'm using crystal report control component in my application. I've created report with two parameters. My report is working well alone by refreshing and passing parameters. But I'm facing problem in vb6, while I call report with passing parameters. I'm getting Invalid parameter field value. This is my code below.
cr1.ParameterFields(1) = "pBankCode;" & lstrBankCode & ";True"
cr1.ParameterFields(2) = "pDate;" & Format(cmbPaymentDate, "dd/MM/yyyy") & ";True"
cr1.ReportFileName = App.Path & "\rptCovLetToCommodityPmnts.rpt"
cr1.Action = 1
Pls. anybody give me the soln. I tried in different ways. Tnx in adv.
Balasubramanian K.
|
|
|
|
|
BalasubramanianK Wrote<quate>But I'm facing problem in vb6, while I call report with passing parameters. I'm getting Invalid parameter field value.
Why do you still use vb6 in 2009 ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|