Handling Strings - Only Choose "10" Rather Than "2010"

Sep 7, 2010

Let say for example that the year today is 2010.. what code can i use so i can only choose "10" rather than "2010".. its like I'm going delete the first two char. or get the 3rd an fourth character in order to display the text "10"...

View 3 Replies


ADVERTISEMENT

Choose The Same Strings From Two List (Of String)?

Feb 24, 2012

I have two List(Of String).Both Lists contain duplicate strings. I want to pick out all the strings which are contained in both the Lists. For example:

List1 ={"10X100","10X100","10X100","50X100","50X100","100X100"}
List2 ={"10X100","10X100","20X100","50X100","50X100","100X100","200X100"}

So, the result should be: List3={"10X100","10X100","50X100","50X100","100X100"}.How to do this?

View 7 Replies

.net - Handling Error Strings?

Aug 14, 2009

In my vb.net application if I have a known set of Error Strings i.e.

Failed because I don't know about it
Failed because I know about it but I can't find it
Failed for another reason

[code].....

View 6 Replies

Handling Long Strings In VB?

Dec 21, 2011

I develop in VB and often I'm writing long TSQL statements in SSMS but getting them into VB is a bit of a pain. I like SSMS during development because I can change the query / structure and test it when there are problems. Some of them become stored procedures and some of them I just keep in the code.I like keeping them in the code because when I have a problem with something, I can GREP my projects directory and find the code that does something (that I've forgotten) or someone asks something about how something works, I can look it up. I've yet to find a GREP for stored procedures. Is there such a thing?I've read in a "best practices" white paper how we're not supposed to concatenate super long strings with & _ but a hundred line proceure is a pain to nest in

sb.AppendLine(" WHERE [q3] IS NULL "
sb.AppendLine(" AND [q4] > 2
"

[code]....

C# handles these things much better than VB. I'm wondering how I can keep my code together during development and searchable later. I had my hopes up when VS 2010 offered implicit line continuation, that this would help my multi line SQL procedures. Again, I was mistaken. Perhaps I could write it all on one line. I'd be interested in knowing if there's a feature that I am not aware of. Well there are certainly many features which I'm not aware of, but I was referring to "long strings".

View 1 Replies

VS 2008 Handling Strings?

Apr 12, 2010

I once again feel so angry about VB .NET . Here's what ruined my day :Lets say we have have a string variable :

Dim Var1 As String = "blablabla"
If we want to replace something within it , we can use the Replace function :
Dim Var2 As String = Replace(Var1,"a","o")

This works great . My problem appears when I want to replace the " character (double quote) . Thus , when using :Dim Var2 As String = Replace(Var1,"""","o")it will return an error .Of course you may wonder why I care to replace the " character . You see this string variable receives its value from a text box . Thus , if the user uses the " character , I want to replace it with two ' characters (single quote) . Is this replacement possible in .NET

View 4 Replies

VS 2010 Randomizing - Program Randomly Choose Questions - NEVER Choose Same Question In Same Program

Dec 20, 2011

I am currently working on a family project which is based on "Who Wants To Be A Millionaire?" show. There is a huge diffrence between the show and my project. My project is a christmas edition and the goal is not to get money or something, since I will not add it... Erhmm... Let me get to the point. I have already designed a layout and scripted some things. I have about thirty questions but I do not want them to always spawn in the same array, if you know what I mean. I want the program to randomly choose one of those thirty questions and NEVER choose the same question in the same program run. By the way, there are four options on my project: A, B, C and D. I have got everything, I just need a code.

View 3 Replies

Handling Long Strings - Change The Query / Structure And Test It?

Jul 9, 2010

I develop in VB and often I'm writing long TSQL statements in SSMS but getting them into VB is a bit of a pain. I like SSMS during development because I can change the query / structure and test it when there are problems. Some of them become stored proceduresand some of them I just keep in the code.

I like keeping them in the code because when I have a problem with something, I can GREP my projects directory and find the code that does something (that I've forgotten) or someone asks something about how something works, I can look it up. I've yet to find a GREP for stored procedures. Is there such a thing?I've read in a "best practices" white paper how we're not supposed to concatenate super long strings with & _

[code]...

C# handles these things much better than VB. I'm wondering how I can keep my code together during development and searchable later. I had my hopes up when VS 2010 offered implicit line continuation, that this would help my multi line SQL procedures.Again, I was mistaken. Perhaps I could write it all on one line. I'd be interested in knowing if there's a feature that I am not aware of. Well there are certainly many features which I'm not aware of, but I was referring to "long strings".

View 2 Replies

Sql Server - Handling Null Strings When Concatenating Select Statement?

Nov 9, 2011

I have this simple-minded query:

select a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr from mytable

This query works as long as none of the concatenated values are not NULL. If any is null, the address does not show.

I tried this:

select IsNULL(a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr,'') from table

What I would like to accomplish is to replace NULL with empty space if the value is null but I still get no values.

View 3 Replies

VS 2010 Finding Strings Within Strings?

Jan 8, 2012

Is there an easy way to find a certain string within a string and then return the strings that you find as an array?I have written this:

Public Function FindStrings(ByVal strSourceString As String, ByVal strStartString As String, ByVal strEndString As String) As String()
Dim StringStartposition As Integer
Dim StringEndPosition As Integer
Dim Currentposition As Integer = 1

[Code]...

View 16 Replies

VS 2010 Separate Strings Into Other Strings?

Jan 16, 2011

I have this string called time. It's value is in this format: HH:MM:SS The numbers change, but the format stays the same. I want to separtate the code into 3 strings Hour, Minutes, Seconds.

View 2 Replies

Way To Concatenate List Of Strings Into A Comma-separated Strings, Where Strings Are Members Of An Object?

Oct 16, 2009

Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?

View 2 Replies

VS 2010 How To Choose Form At Startup

Aug 12, 2011

I'm trying to make a program that will open a first-run form when the program is run for the first time. I'm planning on just using a setting in My.Settings.VariableName to keep track of the boolean value. My problem is that I cannot figure out how to choose what Form to open.

My first instict would be to use a Sub Main() as my program instance, and then choose and open forms from there, but I can't find a way of doing it. and Many a post suggest not doing it.

Second I tried using ApplicationEvents Myapplication_Startup, but this makes the form pop up before my splash screen, and doesn't stop my main form from showing.

View 2 Replies

IDE :: Can't See Any Option To Choose Line Highlighting [VB 2010]?

Jun 23, 2009

In VS 2010 CTP I read about two new features: line highlighting and zooming. Zooming works perfect, but I can't see any option to choose line highlighting. I thought it'd appear in Beta 1, however there's no this feature either. Will this future work?

View 1 Replies

VS 2010 - Time Scheduling Control That Allow User To Choose

Dec 10, 2010

I once saw in an app a control that allowed the user to choose when they wanted the Timer running. It looked something like this: And when the squares are green, for example Tuesday 3:15 AM - 4:15 AM, the timer would run during that time period. I'm curious as to what control will allow me to do something similar?

View 3 Replies

Does Not Have The Choose Microsoft SQL Server (SqlClient) In VB 2010 Express Edition

Nov 28, 2011

I have version VisualBasic.2010 Express Edition , but this version Does not have the choose Microsoft SQL Server (SqlClient) when open vb.net choose : add new data source and choose database and add connection Does not have the choose Microsoft SQL Server (SqlClient)

View 1 Replies

VS 2010 Ftp - Promotion System Randomly Choose A Name (with Numbers And Letters - At Least 5)

Nov 17, 2010

This code raise the FTP server files

[Code]....

Now I want to know how to do the following:

1. Select a maximum size per file

2. Promotion system randomly choose a name (with numbers and letters - at least 5) Then the program will show me a link to a file after uploading (for example: [URL] in TextBox2.text)

View 6 Replies

Error Handling When Using VB 2010 Express?

Jun 3, 2012

I used the following code(with bug):

Code:
For n = 0 To 100
If saveLine(n).Substring(0, 8) = "heading:" Then
cboSelect.Items.Add(saveLine(n).Substring(8))
End If
Next n

The For loop only ran 5 times. It turned out that saveline(5) was shorter then 8 characters, so I changed the code which solved the problem:

Code:
For n = 0 To 100
If saveLine(n).Length > 8 Then

[code]....

VB 2010 neatly exits the for loop when the bug occurs. In this case it was easy for me to pick up the bug, because the combo box was not properly populated. What if it was not obvious that the for loop did not complete? It is quite scary to think that bugs like this are not displayed at run time.

View 4 Replies

Structured Exception Handling 2010

May 10, 2011

Anyone out there who happens to have an exhaustive code snippet for SEH (including all possible exceptions) for VS 2008 or VS 2010 (.NET 3.5 or 4.0) ?

View 10 Replies

VS 2010 - Textbox Handling For XML While Loops

Oct 18, 2011

I have a sub which creates an XML file but the thing is, all the parameters are 'hardcoded', so I decided to give some inputs so each data in each node is customizable. Now, I would like a loop to read the text in textbox1 and assign that to variable one, do the same for textbox2, write the node, loop again (using the same variable) and assign that variable a value in textbox3 and write the node.

I can while loop to write nodes, but only for fixed data or data with 500000 variables for each loop. Is there any way to do this such that on each loop it dynamically sources the variables data from the 'next text box'. i.e. One first loop uses textbox1, second loop it knows it has used textbox1 .'. it uses textbox2 etc... Is there a way to do the same thing but write back to text boxes in an order, knowing what was previously written.

View 1 Replies

VS 2010 : Handling Unhandled Exceptions In A DLL?

Aug 29, 2011

How does one handle unhandled exceptions in a DLL? VS doesn't give me the option to add Application Events, I'm guessing because it's a DLL. Do I just have to do it in the main app?

View 8 Replies

VS 2010 AppActivate Error Handling?

Dec 17, 2011

I am trying to add some error handling for AppActivate if any error occurs.I initially tried using a try statement and cancelling the sub that calls the function where my AppActivate code is, but that didn't work.I have tried looping it, changing values and everything I know. I have Googled and nothing :S

Here is my I have removed all the error handling I tried to implement, however, this commented msgbox I would like to be included (that is, possible to execute) in any methods you present.

[Code]...

View 1 Replies

VS 2010 Dynamic Event Handling?

Apr 4, 2011

i am creating ovalshapes during runtime....and i want to trigger an event when its clicked,an array a(5) is declared as ovals

View 2 Replies

VS 2010 Event Handling On DataGridViewComboboxColumn?

Jun 20, 2012

I'm trying to manipulate the events of the dataGridViewComboboxColumn in order to execute an SQL statement based on the value change of the cell (IndexChanged) and update the database table. Either this or how can i update several rows in a table from a datagridview ? if you check my previous posts you'll understand the whole story behind this question and to which grid i'm refering to.

View 2 Replies

VS 2010 Handling Multiple Events At Once?

Nov 23, 2011

I took a VB class a couple semesters ago and I did really well. Unfortunately, it seems as though we only covered the very basics within the class, as I feel rather clueless right now.

Here's my issue. I'm trying to write a program that will encode notes (like music notes, A-G#) which are entered by the user, into digits, 0-9. Now I have the system laid out, in that 1-8 will represent A-A, while a 0 or 9 preceding a digit will represent a flat or sharp respectively.

Now my question is actually rather basic, but I just can't seem to figure out how to do this. The user will enter the note sequence by clicking on buttons (12 of them). What I'd like to do is create one sub that will handle all possible button clicks. I suppose it's possible that I could have separate subs for each and every button; but it just seems more efficient and cleaner to have one sub that manages them all.

The part I have completed and working properly will display a message (the same message) in a messagebox each time any of the buttons are clicked. So I have the "Handles" part working for all 12 buttons. But what I'd like to do is write code, perhaps "If" statements such that If "btnA" is clicked, then say "You clicked Button A," and If "btnASharp" is clicked, then "You clicked Button A Sharp," and so on. Is it possible to do this somehow by recognizing which event was actually triggered?

View 2 Replies

VS 2010 Handling The Parent's Events?

Jan 28, 2012

I am trying to make a UserControl or Component which can be dragged from the Toolbox onto a container control such as a Form or a Panel. Its purpose is to change the behaviour of that container. In particular, I would like to add functions to the container's painting and mouse actions. I DO NOT want to have to write code for the container itself -- that's the whole point of the Toolbox object.

I can do this by getting a reference to the object's Parent (or Host in the case of a Component) and handling its events, as this example illustrates:

[Code]...

However, I have heard that handling the events of a parent control conflicts with OOP principles. So I would like to know, does that objection apply in a case like my example? If so, what are the drawbacks? And what alternative techniques are available?

View 2 Replies

VS 2010 Unable To Do Error Handling

Feb 21, 2011

I was just wondering if it is considered overkill to add:

[code]...

To every sub in your project. And what would be the side effects of this if any.

View 6 Replies

VS 2010 - Handling Result Of Inner Join Query

Mar 25, 2011

I am using an Access database to store (filepaths to) pictures as well as comments people can leave on them. One picture can have multiple comments, so the tables look like this:
_____________ _____________
|Photos | |Comments |
|------------| |-------------|
|Id (PK) | |Id (PK) |
|PhotoPath | |PhotoId (FK) |
|Description | |Comment |
|____________| |_____________|

What I need to do now is retrieve a list of all Photos along with their Comments. So I have a class Photo with a collection of Comments:
vb.net
Public Class Photo
Public Property Id As Integer
Public Property PhotoPath As String
Public Property Description As String
Public Property Comments As List(Of Comment) End Class Public Class Comment
Public Property Id As Integer
Public Property PhotoId As Integer
Public Property Comment As String
End Class

I can retrieve the records using an INNER JOIN query (right?), as such;
SELECT Photos.*, Comments.*
FROM (Photos INNER JOIN Comments ON Photos.Id = Comments.PhotoId)

From the result of that, for each row in the result I can create a new Photo instance, set its properties and put it in a List(Of Photo) for further processing (displaying). However, how do I handle the Comments? With this query I would get a lot of duplicate Photos. I'd get a row for each comment, but most of these rows will represent the same photos... How do I handle this the best way? I have used inner join queries before, but only for a one-to-one relationship so I never had this problem before. Now when I finally need a one-to-many relationship I realize I've no idea how to handle this appropriately...

There must be some standard way of handling this? When I previously handled cases like this I didn't use an inner join, I just retrieved all Photos first, then iterate through them and run another query to retrieve the Comments that belong to that Photo (SELECT * FROM Comments WHERE PhotoId = ?). That works fine, but when the tables are getting larger it is getting noticeably slower. So I want to do it in a single query, I definitely want to avoid running hundreds of queries if I can.

View 5 Replies

VS 2010 Database Connection Error Handling?

Mar 4, 2011

I want to handle errors that might occur when user tries to connect to database. I don't know how to do that.This is my connection string used all over the program:

Using connection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtFilePath.Text + ";Jet OLEDB:Database Password=" + txtFilePassword.Text + ";")
There are a few errors that i faced them myself:

[code].....

View 2 Replies

VS 2010 Easy Global Numeric Key Handling?

Oct 5, 2011

I have an application which is strictly numeric input only, for everything in the main form, call it X in this post.

I want every single control that can handle input in X to only accept numeric entries, I have a way of doing this but it requires me to put a tonne of arguments for the handle, I tried to change this to handle any .KeyPress event on MyBase or Me (X) but it won't work.

Code that works but requires 1 000 arguments:

Private Sub numeric_keys_only(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles msTEXT.KeyPress, ssText.KeyPress etc...

[Code]...

I have tinkered with the latter, specifying things like all the controls in a certain group box and it doesn't work.

I know the sub header has to be changed - I have changed it in my tests, that is just the example code. When I change everything it runs, just doesn't do anything.

View 2 Replies

VS 2010 Form Not Updating During Event Handling?

Jan 11, 2010

I'm struggling to get a label or any item updated during an event handler I've tried Form.refresh/update, application.doevent, trowing laptop out of window, etc...

If i check for TextChange event on the label and return the value in a msgbox it is set however nothing is shown on the form I'm calling COM's in a backgroundWorker so the form stays responsive as the COMS take quite a bit of time to handle certain parts and I dont want the form to look as if it hangs.

Private Sub cmsCon_Change(ByVal iState As ACSCN.LoginState) Handles cmsCon.NotifyProgress is where the update occurs in the handler by calling the UpdateStatus() Method

Here is the

Imports System.ComponentModel
Public Class Avaya
'declaration

[Code].....

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved