|
|
uglyeyes wrote: Pos
IndexOf
uglyeyes wrote: Strip
Replace
I'd recommend that if you're having this much trouble with working out string functions, which appear in intellisense, that you buy a VB.NET book and work through it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks guys may be i didnt mention it clearly i dont have any problem getting start and end for the first time. I mean How do i loop through all the strings so that i get all the texts that are in between '#'
|
|
|
|
|
One easy way is to use the split function on the string class. This will return an array of substrings, so you can move through them, known that one denotes the start of a bold section, then next, the end of it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Use substring function.
It acceps 3 arguments("I want #this# word bold",start+1,end-start-1).
Here start will be 7(first #),end will be 12(second #).
So U want characters from 8 to 11.
Regards,
Arun Kumar.A
|
|
|
|
|
I check the intellisense it only supports upto 2 argument in vb.net (1.1) both int and int,int
I am trying to print all the text in bold that are inside # in powerpoint.
Dim oldText As String
Dim newText As String
Dim starts As Integer, ends As Integer
oldText = "I want #this# bold. I want #that# bold.I want #this# bold. I want #that# bold."
'This gets the first
starts = oldText.IndexOf("#")
'get second occurance
ends = oldText.IndexOf("#", starts + 1)
'NEXT STEP
newText = Replace(oldText, "#", "")
PPSlide.Insert(newText)
PPSlide.Select(newText, start, end)
PPSLide.Selection.Fond.Bold = True
PPSlide is a interop power point object.
|
|
|
|
|
uglyeyes wrote: newText = Replace(oldText, "#", "")
PPSlide.Insert(newText)
PPSlide.Select(newText, start, end)
I U use replace, will the start and end remains same?
Regards,
Arun Kumar.A
|
|
|
|
|
Of course not, the string gets smaller by two characters.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, that is what I tried to bring to his notice.
Regards,
Arun Kumar.A
|
|
|
|
|
hope this helps U.
Dim oldText As String
Dim newText As String
Dim starts As Integer, ends As Integer
Dim startsNew As Integer, endsNew As Integer
Dim i As Integer
oldText = "I want #this# bold. I want #that# bold.I want #this# bold. I want #that# bold."
Dim boldCount As Integer,newPosition As Integer,compensateForReplacement As Integer
newPosition=0
compensateForReplacement=0
boldCount=(Number of #es)/2
newText = Replace(oldText, "#", "")
PPSlide.Insert(newText)
For i = 1 To boldcount
starts = oldText.IndexOf("#",newPosition)
ends = oldText.IndexOf("#", starts + 1)
startsNew=starts-compensateForReplacement
endsNew=ends-compensateForReplacement
PPSlide.Select(newText, startsNew, endsNew)
PPSLide.Selection.Fond.Bold = True
newPosition=ends+1
compensateForReplacement=compensateForReplacement-2
Next
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Many thanks but i came up with below code
---------------------------------
Dim ppItem As Microsoft.Office.Interop.PowerPoint.Shape
LOOP
Dim s As String = dr.Item(Strings.Right(Trim(ppItem.TextFrame.TextRange.Text), _
Len(Trim(ppItem.TextFrame.TextRange.Text)) - 1))
s = s.Trim
ppItem.TextFrame.TextRange.Text = s
'ppItem.TextFrame.TextRange.Text = s
'========================
Dim a, b, looplen As Integer
looplen = s.Length
Dim hashWords As String()
Dim strWord As String
For a = 0 To looplen - 1
If s.Substring(a, 1) = "#" Then
a += 1
For b = 1 To looplen - 1
If s.Substring(a, 1) = "#" Then
ppItem.TextFrame.TextRange.Text = strWord
ppItem.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoCTrue
ppItem.TextFrame.TextRange.Text = s.ToString
MessageBox.Show(strWord)
'Microsoft.Office.Interop.PowerPoint = strWord
' PPSLide.Selection.Fond.Bold = True
strWord = ""
Exit For
End If
strWord += s.Substring(a, 1)
a += 1
Next
End If
Next
END LOOP
---------------------------
in above code, each dr value returns a text which is rendered to each textbox in powerpoint.
At a time it brings chunk of record for example
"#Headline#[linefeed]This is a headline.This headline is about #Book#".
now what my code does is bring only character that are between #. so i am having hard time rendering the text in powerpoint slide.
As you might notice:
ppItem.TextFrame.TextRange.Text = s [ it supplies all the strings to a text box, so i dont get the change to iterate through all the string and check #es and print the one with #es
could someone help please
|
|
|
|
|
Hi everybody,
has someone ever tried to serialize a Windows Form with all its controls and properties?
I'm open to all suggestions.
Thanks in advance
Milan Schoemig
Milan.Net
|
|
|
|
|
I guess you need to serialise the state of all your controls. I have done this, many times, but I've stored them in the registry. You could just as easily come up with a file format that contains the data needed to set a forms state.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Im having issues with my if statments for this program.
I have 3 ratiobuttons, each one should do a different task.
The first one works alright, but now the 2nd one will not work because of the logic i believe.
It should deduct the value from label3.text, only if
label3 is higher then the amount of the cheque which is Textbox1
If the value of textbox1 is higher then label3 it has to display a messagebox saying insuficient funds. and then deduct a service charge which is declared as 10$
Here is my code. if anyone is able to assist, it would be greatly appreciated.
Dim servicecharge As Integer
Dim transaction As Integer
Dim Balance As Integer
' Declare the value of service charge
servicecharge = 10
transaction = TextBox1.Text
Balance = Label3.Text
' Deposit Funds to the account
If RadioButton1.Checked = True Then
Label3.Text = TextBox1.Text
End If
' Process a cheque through the account, confirming sufficient funds, If returned NSF the account
' will not be deducted the amount of the cheque, but will be charged 10 dollars.
If RadioButton2.Checked = True Then
Balance = Balance - transaction
ElseIf transaction > Balance Then
MessageBox.Show("Insufficient Funds")
Label3.Text = Label3.Text - servicecharge
End If
' Service charge processed on the account.
If RadioButton3.Checked = True Then
Label3.Text = Label3.Text - servicecharge
End If
End Sub
|
|
|
|
|
PLease, please tell me this is not your actual code ? You have variables called RadioButton1 and RadioButton2 ?
aerosmith2k1 wrote: If RadioButton1.Checked = True Then
If the first button is checked, do this
aerosmith2k1 wrote: If RadioButton2.Checked = True Then
If the second one is checked do this ( even if the first was checked )
aerosmith2k1 wrote: ElseIf transaction > Balance Then
If radio button 2 is NOT checked ( that's what the elif does ) AND transaction > balance, then do this
aerosmith2k1 wrote: If RadioButton3.Checked = True Then
If radio button 3 is checked, no matter if the others are, do this.
I suspect your radio buttons work so only one can be checked, but I'd still do an elif to define the three radio button steps. It makes the code more efficient.
And, I think the elif you ARE using, is your problem. Have you tried stepping through the code in the debugger to see what happens, and how it differs from what you expect ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If RadioButton1.Checked = True Then
Label3.Text = TextBox1.Text
End If
If RadioButton2.checked then
If lbl3.value > textbox1.value then
Balance = Balance - transaction
Elseif textbox1.value > label3.value Then
MessageBox.Show("Insufficient Funds")
Label3.Text = Label3.Text - servicecharge
End if
End if
If RadioButton3.Checked = True Then
Label3.Text = Label3.Text - servicecharge
End If
If I am not wrong at getting your logic ,You can try this one
Develop2Program & Program2Develop
|
|
|
|
|
I greatly appreciate your help, very Patient
|
|
|
|
|
Hi boys and girls,
i tried to include a WGA check to my app (plz dont ask why o.o) so i downloaded Windows Defender and copied the "LegitLib.dll" from the program foler to my app folder.
with PE-Explorer i saw that there are the following functions inside this dll
1. LegitCheck
2. LegitCheckCA
3. GetNextStep
4. GetLastErrors
5. SetPartnerID
that sounds good but i have absolutely no idea how to include this into my app! could anybody hel and if its possible explain it me?
many thx!
Sereby
|
|
|
|
|
Probably only Microsoft knows how to use it. There is currently no documentation on the library.
But, I have to ask. Why on earth would your app even care if Windows is authentic or not? You're not Microsoft. I actually see a problem with you using it. WGA isn't exactly the perfect authenticity scanner. It CAN, and does, fail legit machines. What would your customers think about that?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi,
I am using a simple function which returns a dataset. I get a warning that function does not return value on all code paths.Normally i just say throw in the catch block, which solves the problem.
But as i am implementing enterprise exception block the suggestion is to use a policy with if(rethrow) statement, which i beleive creates the warning as throw is hidden inside if statement. I can say return nothing at the end of catch but i was wondering
What is the best way to get rid of the warning.
Public Function SearchEscalationMails() As DataSet
Try
Dim dbResourcePlanning As Database = DatabaseFactory.CreateDatabase()
Dim strProcName As String = "SearchMailEscalations"
Dim dbSPCommand As DbCommand = dbResourcePlanning.GetStoredProcCommand (strProcName)
dbResourcePlanning.ExecuteDataSet(dbSPCommand)
Return dbResourcePlanning.ExecuteDataSet(dbSPCommand)
Catch ex As Exception
Dim bRethrow As Boolean
bRethrow = ExceptionPolicy.HandleException(ex, "BusinessLayerPolicy")
If (bRethrow) Then
Throw
End If
End Try
End Function
-- modified at 10:49 Sunday 29th April, 2007
|
|
|
|
|
Inside of the exception nothing is returned. It might be better written like this:
dim ds as DataSet = Nothing
Try
...
ds = dbResourcePlanning.ExecuteDataSet(dbSPCommand)
...
Finally
Return ds
End Try
End Function
Hope that helps.
Ben
|
|
|
|
|
Hi Kubben, i think this helps, thanks for your suggestion.
|
|
|
|
|
If you don't rethrow the exception, you have to return something:
If (bRethrow) Then
Throw
Else
Return Nothing
End If
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello,
I am new to .Net and I am looking to add a custom tooltip to a link button with a close button.Please let me know how I can do that .
Thanks,
Uday.
Uday
|
|
|
|
|
Are you taking about a web application? If you are the LinkButton has a property called ToolTip. Just set that property to the correct ToolTip. If you want the browser to close you have to do it in javascript.
Here's some vb code for .net 1.1
Private Sub closeWindow()
Dim myScript As New StringBuilder
With myScript
.Append("<script>")
.Append(Environment.NewLine)
'Close the window
.Append("self.close()")
.Append(Environment.NewLine)
.Append("</script>")
Page.RegisterStartupScript("close window", .ToString())
End With
End Sub
If you are using .net 2.0 the registerstartupscript is a little different.
HOpe that helps.
Ben
|
|
|
|