|
Yes this works here is what i did off course the same
Dim MyString As String = "YS3EB45E833005745_20050610_WINDSHIELD"
MySplitLine = MyString.Split("_")
MessageBox.Show(MySplitLine(1))
and its returning 20050610
But like you mentioned .ToCharArray()may be an efficient way of doing it.
we need to use ToCharArray() because we are splitting a string?
Thanks
-L
|
|
|
|
|
Slow Learner wrote: we need to use ToCharArray() because we are splitting a string?
No, I use it for documentation purposes, it is more clear what the code is doing, imo, when I see tochararray(). That being said, I recall I may have had issues when I had a string longer than one charater. Nonetheless, your code returns the correct results, so at the end of the day, our code is managerially equvilant
Slow Learner wrote: .ToCharArray()may be an efficient way of doing it.
Although many people will argue this point to death, I feel efficent is only releveant in the 20% of the code that does 80% of the work in the program. Most of a program is scaffolding to support the core logic, anyway. Therefore, who cares if some ui element take 20 extra ns to complete. The user cant tell the difference! 80% of the code should be simple and readable 20% (that which does the work) should be "efficent"
do you need to investigate an online backup[^] company
|
|
|
|
|
Sure i like your arugment. If the code is more readable and understandable it would be easy for another developer who comes in after we left. I agree with you
thanks
-L
|
|
|
|
|
If you would like the code to be more efficient, you should get rid of the Split all together (as that creates at least two strings that you don't even use). Use IndexOf to locate the first and second "_" in the string, then use Substring to get the part of the string in between.
Still I agree with Jason's opinion that most of the code doesn't need to be optimized to the max. Consider how often the code will be used, and how much resources it uses compared to the surronding code.
Simple code that works is always better than optimized code that doesn't.
---
b { font-weight: normal; }
|
|
|
|
|
Good explanation and thanks for the reply. I am excited trying the same thing in different ways and figure out the best option.
Here is how i am trying to get the index of the string i posted in my string YS3EB45E833005745_20050610_WINDSHIELD
Dim indexOf_ As Integer
indexOf_ = fileName.IndexOf("_")
the above one gives me the index of the first occurance of the "_". How do i get the second occurance of the "_" and then use the substring?
Thanks for the reply,
-L
|
|
|
|
|
You can use either LastIndexOf("_") or IndexOf("_", indexOf_ + 1).
For Substring you need the index of the first character and the length.
The first character is located at indexOf_ + 1.
The length I believe is the index of the second _ minus indexOf_ minus one.
---
b { font-weight: normal; }
|
|
|
|
|
I want to connect sql with vb.net and want to add and delete the record programically i.e using insert alter command etc. If somebody helps me , I am in urgent need of it.
Thanks and Regards
Pankaj Garg
|
|
|
|
|
|
|
I think you want to show something on form2 based on a value passed from form1, if thats rigth, just add the following code to form2
'Val can be any name and any type
Public Overloads Sub show(ByVal val As Integer)
'Load your custItemsDataSet or assign Val to a local variable or do what you got to do to load your dataset
Me.Show()
End Sub
Alexei AR
Theres always a better way
Look for it
|
|
|
|
|
I am doing code on treeview , where I got stuck in attaching files an folder icon to the particular file and folder dynamically.I mean I want to attach the file and folder icon dynamically during populating the treeview with system drives.If somebody send me the code for the same .I am in urgent need of it.
Thanks and Regards
Pankaj Garg
|
|
|
|
|
How do you create and populate DBASE3 files using Data Access Objects (DAO) from Visual Basic 6?
TJWH
|
|
|
|
|
Use ODBC Driver for Dbase3
DR
|
|
|
|
|
I know it's a bit cheeky but have you got a code snippet to give me a head start?
TJWH
|
|
|
|
|
no i dont have code as i dont use ODBC . look in google
Divya Rathi
|
|
|
|
|
can anyone help me to add RichTextBox to DataGridView abd Show RTF Formmatted Code in DataGridView?
DataGridView does'nt show rtf in the Text columns and i want to add Richtextbox to datagrid view to show them.
|
|
|
|
|
Background: I have a number of PC's (XP) that i have on remote sites and i want to write a piece of software that will back them up to my server to save me the time from going to do it manually every week!
What I want: Guidance on what i should be doing! I am a relativly new developer in vb.net(2003) and would like some pointers in the right direction.
Cheers
Denis
|
|
|
|
|
A question rather then advice, why are you building a wheel that already exists. There are many remote backup systems out there but there are $$$ involved.
What do you have to backup, or more importantly how big is the backup? What damage will it do to your WAN.
That said here is what I did to backup several servers under my care back to head office.
Step 1: Schedule MS Backup to run at a time that suites (for me 6pm Friday)
Step 2: Write or Script WSFTP (or most other FTP apps) to pickup the file and send to you.
I backup system state and local stored files plus grab SQL db from 2 servers.
As I could not be sure of how long the backup would take I start the FTP two hours after the backup. Size is the biggest prob as one server has 5 gig on it and this takes time even with a fast pipe
I know it is simple but sometimes that is the best.
If your desire is to code the start with the FTP app I have written a few and they are OK if you keep it simple.
Backup, compression, checking file states, handling system files can be very difficult
Hope this helps...
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
Many thanks. We are looking to roll the app out as a stand alone serviceto a handfull of our home clients too and was hoping we could produce a simple package that they could setup themselves.
We have 20 machines to backup for us and have storage to take on about an extra 200 desktops.
I don't mind spending a bit as we will be charging them for the space on our servers to help us cover our new pipe!
Your solution would be usefull to us for our pc's but not the other.
Cheers for the quick reply. If you have any suggestions please fee lfree to send them on
Regards
Denis
-- modified at 11:07 Wednesday 22nd February, 2006
|
|
|
|
|
Hi,
Can I Create Template columns in VB .NET Datagrid just like ASP .NET Datagrid ?
If yes then plz mention the procedure else give me the alternate solution.
Thanks n regards
Pankaj Kulkarni
|
|
|
|
|
Hi,
I am trying to create a dropzone form which is completely blank (No controls) so that I can drag and drop any file from the desktop onto the form which then moves the file from the desktop to the directory c:\dropzone
All I can find so far is drag and drop with controls not just the form.
Can anyone help with the VB.net code ?
|
|
|
|
|
I want to remove all the text boxes in a data report during run time.
I used the following code, but it shows error.
[CODE]
For i = 1 To DataReport1.Sections(3).Controls.Count
If TypeOf DataReport1.Sections(3).Controls.Item(i) Is RptTextBox Then
Unload DataReport1.Sections(3).Controls.Item(i)
End If
Next i
[/CODE]
[ERROR]
Can't load or unload this object
[/ERROR]
Guide me to rectify this.
Thanks in advance.
|
|
|
|
|
i have a stand alone vb.net application that used to send messages to a mobile device.It should use
some webservice which in turn turn needs contact to a java portal.can anyone help me to explain how can i achieve this....
From: jay
|
|
|
|
|
Hi,
I created a web parts control consisting of a listbox and a pop up menu. When the user rightclicks on the listbox, the pop up menu is supposed to appear.
However, the menu always seems to be blocked by the listbox e.g The menu seems to be in the background and is partially blocked by the listbox. Something like dragging 1 control on top of the other on a windows form.
How do I enable the menu to be displayed on top of the listbox?
Below is a code snippet in vb:
'Creates child controls (a menu and a listbox)
Protected Overrides Sub CreateChildControls()
listbox1.ID = "List1"
listitem1.Text = "Testing"
listbox1.Items.Add(listitem1)
listbox1.AutoPostBack = True
Me.Controls.Add(listbox1)
AddHandler listbox1.SelectedIndexChanged, AddressOf Listbox1_SelectedIndexChanged
menu1.ID = "ContextMenu1"
menuitem1.Text = "Acknowledge"
menu1.ContextMenuItems.Add(menuitem1)
menu1.boundcontrols.add(listbox1)
Me.Controls.Add(menu1)
End Sub
I tried changing the order of the controls but its still the same thing. Any solutions for this problem?
|
|
|
|
|
I want to validate my certificate. Can any body help to get CRL list through code and check whether certificate is revoked or not. Thanks in advance....
|
|
|
|