473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

right function

To all,

I'm using the current code below and for some reason I'm not getting
anything into my variable. I'm expecting to see "efghijk". I have rebuilt
my project/solution but still to no avail. This code has worked at one point
but I can't explain why it doesnt work. Any help or suggetstions.

Dim account As String
account = "abcdefghijk"

Dim TESTing As String = Microsoft.VisualBasic.Right(account, 7)

Thanks,
Michael
Feb 14 '07 #1
10 1756

Does it work if you write it:

Dim TESTing As String

TESTing = Microsoft.VisualBasic.Right(account, 7)
Michael de Vera wrote:
To all,

I'm using the current code below and for some reason I'm not getting
anything into my variable. I'm expecting to see "efghijk". I have rebuilt
my project/solution but still to no avail. This code has worked at one point
but I can't explain why it doesnt work. Any help or suggetstions.

Dim account As String
account = "abcdefghijk"

Dim TESTing As String = Microsoft.VisualBasic.Right(account, 7)

Thanks,
Michael
Feb 14 '07 #2
John,

I tried the code but it still did not work.

Michael

"John Bailo" wrote:
>
Does it work if you write it:

Dim TESTing As String

TESTing = Microsoft.VisualBasic.Right(account, 7)
Michael de Vera wrote:
To all,

I'm using the current code below and for some reason I'm not getting
anything into my variable. I'm expecting to see "efghijk". I have rebuilt
my project/solution but still to no avail. This code has worked at one point
but I can't explain why it doesnt work. Any help or suggetstions.

Dim account As String
account = "abcdefghijk"

Dim TESTing As String = Microsoft.VisualBasic.Right(account, 7)

Thanks,
Michael

Feb 14 '07 #3
Michael de Vera <MS***********@nospam.nospamwrote:
I'm using the current code below and for some reason I'm not getting
anything into my variable. I'm expecting to see "efghijk". I have rebuilt
my project/solution but still to no avail. This code has worked at one point
but I can't explain why it doesnt work. Any help or suggetstions.

Dim account As String
account = "abcdefghijk"

Dim TESTing As String = Microsoft.VisualBasic.Right(account, 7)
Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 14 '07 #4
Hi Michael,

I performed a test on Microsoft.VisualBasic.Right function, but didn't
reproduce the problem. The function always returns the correct result in my
test.

Perhaps the variable 'account' has been changed before you call
Microsoft.VisualBasic.Right function.

If the problem still exists, you may show us your complete related code or
send me a sample project that could just reproduce the problem. To get my
actual email address, remove 'online' from my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 15 '07 #5
To all,

Below is the complete code that I'm using to build a treeview. As you will
see each node is populated by a category ....such as NA division, department,
then employee name. What I'm trying to do is to parse the node value that is
passed to my sub-routine called, "Information". The node that passes the
value to my information subroutine is from the subroutine called, "Employee",
which has a value in a comma delimeted information ....e.g. Michael de Vera,
1234. The value is passed when a user clicks on the appropriate node in my
tree view.

What I'm trying to do is to only get 1234. I can put a break in my code and
see that the node.value from the subroutine employee is actually passing the
correct value when the appropriate node is clicked for employee. I tried
several variations to figure why the right function code won't work but I'm
still unsuccessful. I have also tried using instr and mid functions but
those don't work either.

Thanks for any help.

Michael

Protected Sub tv_NA_Divisions_TreeNodePopulate(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles
tv_NA_Divisions.TreeNodePopulate
If e.Node.ChildNodes.Count = 0 Then
Select Case e.Node.Depth
Case 0
PopulateNADivision(e.Node)
Case 1
PopulateNADepartment(e.Node)
Case 2
Employee(e.Node)
Case 3
Information(e.Node)
End Select
End If
End Sub

Sub PopulateNADivision(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Division_Description()

If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("NA Divisions").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If

End Sub

Sub PopulateNADepartment(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Department_Description(node.Value)

If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("NA Departments").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If

End Sub

Sub Employee(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Employee_by_Department(node.Value)

If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("Employee Name").ToString() & "," & " " &
row("EXT").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If

End Sub

Sub Information(ByVal node As TreeNode)

Dim account As String
account = "abcdefghijk"

Dim TESTing As String
TESTing = Right("abcdefghijk", 4)
'Dim GID_String As String = Microsoft.VisualBasic.Right(node.Value, 4)

End Sub

End Class

"Linda Liu [MSFT]" wrote:
Hi Michael,

I performed a test on Microsoft.VisualBasic.Right function, but didn't
reproduce the problem. The function always returns the correct result in my
test.

Perhaps the variable 'account' has been changed before you call
Microsoft.VisualBasic.Right function.

If the problem still exists, you may show us your complete related code or
send me a sample project that could just reproduce the problem. To get my
actual email address, remove 'online' from my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 15 '07 #6
OK! Call me the biggest dummy! I was not setting my breakpoint past the
right function ....thus not seeing any value inside of the variable called,
account. If I were to do the following the below then everything
works.....especially if I put my breakpoint on textbox1.text.

Sorry for any confusion that I may have caused.
Dim account As String = "abcdefghijk"
Dim TESTing As String

TESTing = Microsoft.VisualBasic.Right(account, 7)
TextBox1.Text = TESTing

"Michael de Vera" wrote:
John,

I tried the code but it still did not work.

Michael

"John Bailo" wrote:

Does it work if you write it:

Dim TESTing As String

TESTing = Microsoft.VisualBasic.Right(account, 7)
Michael de Vera wrote:
To all,
>
I'm using the current code below and for some reason I'm not getting
anything into my variable. I'm expecting to see "efghijk". I have rebuilt
my project/solution but still to no avail. This code has worked at one point
but I can't explain why it doesnt work. Any help or suggetstions.
>
Dim account As String
account = "abcdefghijk"
>
Dim TESTing As String = Microsoft.VisualBasic.Right(account, 7)
>
Thanks,
Michael
Feb 15 '07 #7
Hi Michael,

Thank you for your sample code.

Firstly, I notice that you are using the TreeNode.Value property in the
subroutines-PopulateNADepartment, Employee and Information. But I don't see
you set the Value property of the treenodes when you create them in the
PopulateNADivision, PopulateNADepartment, and Employee subroutines

Secondly, can you get the correct result ("hijk") in the variable 'TESTing'
in the Information subroutine? What's the value of the 'node.Value'
expression in the Information subroutine? You may have a try using the
SubString method of String to get the substring you want as follows. Please
try it to see if you can get the correct result.

Dim GID_String As String = node.Value.Substring(node.Value.Length - 4, 4)

Hope this helps.

BTW, I will be on a long vacation from the next Monday to Friday. During my
leave, my team mates will follow up with you and it may not in time. Sorry
for the inconvenience it may bring to you!
Sincerely,
Linda Liu
Microsoft Online Community Support

Feb 16 '07 #8
Hi Michael,

Since my colleague Linda is on vacation this week, I will continue to work
with you.

How about this issue now? Does Linda's reply make sense to you? If you
still need any help, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 20 '07 #9
Jeffrey,

Thanks for your response. I made an earlier post on 2/15 indicating my
issue as a mistake of my own. I wasn't putting a break past my variable to
see if it would be populated by a string that contained a right function.

This was a very rookie mistake.

Thanks,
Michael

""Jeffrey Tan[MSFT]"" wrote:
Hi Michael,

Since my colleague Linda is on vacation this week, I will continue to work
with you.

How about this issue now? Does Linda's reply make sense to you? If you
still need any help, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 20 '07 #10
Hi Michael,

Oh, thanks for your confirmation. It seems that I missed that reply in this
thread, sorry.

Anyway, if you need further help, please feel free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 22 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: yaktipper | last post by:
This explains how to disable the view source / right-click menu in Netscape 4, Netscape 6 and Internet Explorer (IE). <script language="JavaScript"> //This code is the beginning of the right...
8
by: George Hester | last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to...
9
by: Ook | last post by:
I need a function that swaps arguements. This is my function. It works, after calling swapArgs aa now has 321, and bb has 123. My question - did I do it right? Just because it works doesn't mean I...
3
by: Bill Smith | last post by:
Anyone have a one liner of code to getting the right side of a string after the last occurence of a given character? Thanks, Bill ie '*abc*def*ghi' would yield '*ghi' (or 'ghi' would be...
16
by: Alex Clark | last post by:
Hi All, I'm sure this must have been asked a million times due to it's usefulness, but are there any sensible solutions for disabling right click (and other services such as Ctrl+P, Browser...
6
by: James Brown [MVP] | last post by:
Hi, I am having trouble understanding how the 'const' modifier affects the 'left-right' rule when deciphering c-declarations: const int *x; // x is a pointer to a 'const int' int const *x; ...
8
by: marco | last post by:
Hi ! I have this part of code and i can not find out why the scroller is starting from left to right instead RIGHT to LEFT. This is the main part and the scroller is working fine but from the...
9
by: sql guy123 | last post by:
I normally use MS ACCESS vs MS SQL,, which has a left() and right() function. I need to use MS SQL for this project but I am not familiar with it. I have read a few books, but can not figure out...
52
by: marc | last post by:
Hello, Is it possible to right pad with "0" (or other character != blank) ? for example : 1 , length 10 ="1000000000" I've tried with sprintf but I can only left pad with "0" or right pad with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.