Reduce This Code To A Single Procedure?

Jan 16, 2012

I am relatively new to the whole .NET thing, coming from a VB classic background.On my form I have a tabcontrol, with 4 tabs. Most of the code is handled using a shared handler, but for the others I have to write a handler for each.How can I optimize these routines into a single procedure?

Private Sub cboCalc0_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCalc0.SelectedIndexChanged
'Page 0
If (Not (IsNothing(trvSignals0.SelectedNode)) And txtSignalName0.Enabled = True) AndAlso trvSignals0.SelectedNode.Level = 3 Then

[Code]...

View 3 Replies


ADVERTISEMENT

Way To Reduce My Code

Feb 15, 2010

I am creating a windows mobile application .I have an extraordinary amount of if/else statements, I have tried the switch/case statement [code]...

View 1 Replies

Way To Reduce Lines In Code?

Jan 25, 2010

I have a school project. by selecting an item from combobox it will show 2 pictures and 2 labels. I used a select case first but it didn't work; only for the first item ;do i have to make every pictures and labels invisible which are 30 controls and repeat it in every index? I try the if else but it did not work too.[cod]

View 4 Replies

Reduce Code By Using Dynamic Queries?

Jul 3, 2011

I use the following code to fill the Table1 dictionary with the information found within the LINQ query.[code]....

View 2 Replies

Reduce My Form Validation Code?

Nov 24, 2010

I have almost 15 forms in vb.net 2005, and i have to validate all them, i am using this [code]...

and is working properly but on each form there are 10 to 15 textboxes, maskedtextbox etc so if i place this code on every textbox so it will be a thounds lines of code? so please assist me that how do i write this code shortly for all forms's textboxes.

View 6 Replies

Reduce Code For Displaying Data In Textboxes?

Mar 10, 2011

On the page I have created I have a search facility that if a doctors number is searched it will bring up the doctors details, once search button is clicked the results are displayed in textboxes (I cannot use gridviews because this is not wanted)sample of code placed on the search buttonQuery statement = "SELECT DocNumber FROM tblDoctor WHERE DNum LIKE '%"execute the query and get the resultThe result is converted to string and Execute Scalar is usedDocNum.Text = Result1

Query statement = "SELECT DocName FROM tblDoctor WHERE DNum LIKE '%"
execute the query and get the result
The result is converted to string and Execute Scalar is used

[code]....

View 2 Replies

.net - C# To Code Converter - Reduce The Amount Of Copy/paste

Aug 29, 2010

I need a C# to VB.NET code converter, I want something that's ultra convenient, as I want to reduce the amount of copy/paste that I have to do... so could anybody give me some tips to what is out there? I want processing in bulk too, and to support the latest operations (LINQ, new VB inline-function support and all).

View 3 Replies

Multiple Stored Procedure, Single Transaction?

Jun 22, 2010

i get an "This SqlTransaction has completed; it is no longer usable." error everytime i run my code:

the main code

If DBOpen() = True Then
Try
'begin transaction

[Code].....

i specified the transaction of sqlcommand named cmd via the Public Sub BeginTranscation. but, is this correct?

also, the error points to the Public Sub RollbackTransaction if the insert to the stored procedure fails. : "This SqlTransaction has completed; it is no longer usable."

how can i perform multiple stored procedure calls within a single transaction correctly?

View 1 Replies

How To Call Stored Procedure And Retrieve Single Return Value

Jul 22, 2010

I'm new to LINQ and am having a problem getting proper results from a simple (working) stored procedure that takes no parameters and returns a single Integer. When calling this sproc with LINQ its returnvalue is always 0. When run using tableadapter or directly on the sql server it works, returning 6 digit values like 120123.

Here is my LINQ code:

Dim MeetingManager As New MeetingManagerDataContext
Dim MeetingID As Integer = MeetingManager.NewMeetingID().ReturnValue Here is the NewMeetingID procedure:
ALTER PROCEDURE [dbo].[NewMeetingID]
AS
SET NOCOUNT ON
BEGIN

[Code]...

View 1 Replies

A Procedure With A Single Parameter But The Input Values For That Parameter Are More Than One?

Oct 26, 2011

Is it possible to make a procedure have a single parameter but the values for that parameter are more than one? I have this procedure:

Public Sub autoComplete(ByVal cboCombo As ComboBox)
With cboCombo
.AutoCompleteMode = AutoCompleteMode.Append[code]....

Now I was wondering if there is a way to use it like this:

autoComplete(myCombobox1, myCombobox2, myCombobox3)

Or can I use a procedure like this with 'With...End With'?

View 1 Replies

Execute Part Of The Code In An Another Sub Procedure?

Apr 30, 2011

Suppose I have two buttons btnCheck and btnOK. I want to execute few lines code of btnCheck from btnOK. So that When I click on btnOK, btnOK's code as well as BtnCheck's Code should be executed one after the other. How can I do this in vb.net

[Code]...

View 2 Replies

Getting Results Into Code From An Stored Procedure?

Dec 8, 2009

My app calls for the use of an SP that doesn't return rows from a table, but results based on certain conditions.

View 3 Replies

Sub Procedure - Code Flagged At Two Places

May 19, 2009

How to work a sub procedure. I'm trying to follow my instructors example, but I get a red box around my code in two places, with large red bullets on the left side of each. The program I'm trying to follow is underneath solid line.

First code that is flagged:
Private Sub DisplayResults(ByVal Name As String, _
ByVal Hours As Decimal, _
ByVal Rate As Decimal, _
ByVal GrossPay As Decimal)

And this
OutPutString = Name & " Pay" & Environment.NewLine & _
"Hours: " & Hours.ToString & Environment.NewLine & _
"Rate: " & Rate.ToString("C") & Environment.NewLine & _
"Gross Pay: " & GrossPay.ToString("C")

The flagged code says, "At form1.vb,line 23 character 5('DisplayResults')
2nd Grouping of code that is flagged says, "At form1.vb,line29, character 9('Display Results', line 7")
[Code] .....

View 11 Replies

Change Stored Procedure Parameter Name During Code Gen?

Apr 13, 2011

I am using LLBLGEN Pro to generate a data layer...some of my stored procs have parameter name as "date"...so this is cauing a problem when I compile in VS2010...I have to go through the class and change the function parameters "date" to "[date]".

Is there a way to inject these changes in LLBLGEN Pro during code generation?

View 1 Replies

Linq Stored Procedure - Convert C# Code ?

Feb 3, 2010

Can convert this c# code to vb.net code.

DataClassesDataContext dc =
new DataClassesDataContext();

//proc_GetExistProductDetails is a Stored procedure method from my DataContext class.

[CODE]...

View 6 Replies

Modifying Code To Integrate A Function Procedure

Jun 4, 2009

I'm trying to modify this program so that a function procedure determines the student's grade. The problem is, I don't even know where to start. here's my current code:

[Code]...

View 3 Replies

Stored Procedure From Code Inside A Form?

Aug 2, 2010

I am triggering a stored procedure from code inside a form and I am wanting to return any TSQL errors back to the form. I have written code to do it but when I force an error in TSQL for testing, my vb.net code drops to debug mode with "SQL Exception was unhandled" error.

[Code]...

View 6 Replies

VS 2010 Stored Procedure Doesn't Run From Code?

May 11, 2010

I have a stored procedure that keeps timing out even though I have set the connection timeout set to 10000. The code that runs the stored procedure is this...

ADFConn1 = New System.Data.SqlClient.SqlConnection("Data Source=STPISSQ01ADF;Initial Catalog=ADF;User Id=ADFXXXXX;Password=XXXXXX;Persist Security Info=True;connect timeout=10000;packet size=4096")

[code].....

View 4 Replies

[2008] Code Collapse Procedure Or Function?

Jan 25, 2009

know in 2008 if you have procedures or functions. that there's a little "-" or "+" that lets you expand and collapse that procedure or function? I was wondering if anyone knew how to create a section so I could collapse it within the procedure? The only way I know it will do it between functions or procedures and things like that but not within the procedure.

[Code]...

View 6 Replies

Possible To Display Code In A Stored Procedure In Form Control?

Feb 16, 2011

I am in need of being able to show a user the contents of a Oracle stored procedure. I have no idea of how to go about actually getting and then displaying the code contained in a stored procedure. Does anyone know of a way? I know how to call and execute a stored procedure but is about it. I am developing using VB.NET 2010 with Oracle 10G as my back end.

View 3 Replies

Code In VB 2008 To Access A SQL Server 2005 Stored Procedure?

Jun 12, 2012

I know there are the 'Wizards' to help me, but I need the code to access the Table Manager, the data set and so on, create them in my project and access the tables or stored procedures

View 2 Replies

Windows Forms Textbox Stored Procedure Code Injection?

Jul 12, 2011

I have the following sub in a windows form:

Private Sub BTNC_storeclientdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNC_storeclientdata.Click
' Update Clientdata[code].....

This performs an update in the SQL Database via a stored procedure. When I add '; insert into codeinjection(test) values ('CodeInjected!'); select ' in the last textbox (TBC_phone.Text) the value 'codeinjdected' is inserted into the table codeinjection as well. How can I avoid this?

View 7 Replies

Fill Fields In A Structure In A Single Line Of Code?

Sep 21, 2009

Just suppose that I define a structure, and an array such as

Structure Person
Dim First_Name as String
Dim Last_Name as String

[code]....

Can I fill in my list of people using a single line of code for each record? Something like this, it doesn't work, but this shows the sort of thing I mean.

My_List(0) = {'John', 'Smith', 24, '555-1234'}
My_List(1) = {'George', 'Jones', 31, '555-8123'}
My_List(2) = {'Tom', 'Green', 40, '555-3434'}

It's easy enough to fill it in line by line. I could do that without problem. But I want to be able to look at the code and see the contents of each line. Doing it as above would make it easier to read.I could make it a multidimensional array of strings, rather than a structure.If it makes any difference I'm using Visual Basic 2005 Express Edition.

View 8 Replies

Use Single Quote As Litral In My Code Passing Sql Statement?

May 2, 2011

The code is as follows

dim st as string

st="select * from employees where empName='" & textName.Text &"'"

' The empName is Dani'e

'So the single quote with in the name Dani'e makes the vb.net code to halt.

View 3 Replies

VS 2010 Consolidating Code - Use A Single Datasource (containing All 80 Fields)

Aug 1, 2011

I am converting a VB 6 app to VB.Net. In the vb 6 version I have a table that contains roughly 80 fields. Over that table the users currently have a single form which gives 12 diferent views. Each view is placed on a different tab, which, although giving a distinct set of fields per tab, also leads to a ton of duplicated code. Changing the underlying table is not an option.

What I would like to do is to use a single datasource (containing all 80 fields), a single datagridview on the form, and have a combobox act as the filter choice for the differing views. Does my solution seem like the right way to handle this? If so, I'm not sure I know which controls would best be used.

View 3 Replies

Get The Stored Procedure Have Created At SQL Server Management Studio Using Code Behind The Files?

Aug 3, 2011

How can I get the output data of sql procedure from SQL Server to my asp.net[vb.net] page dropdown list?<asp:DropDownList ID="DdLocation"></asp:DropDownList>

View 1 Replies

Write Code For Single-answer Multiple Choice Tests?

Nov 28, 2009

I am struggling to write code for single-answer multiple choice tests (i.e. Choices A, B, C, D).

View 11 Replies

VS 2008 CodeDom - Create A Procedure Which Will Evaluate A String Expression As If It Were A Line Of Code

Oct 12, 2009

I am trying to create a procedure which will evaluate a string expression as if it were a line of code...Kind of like what a graphing calculator does when you enter a formula. Does anyone have any experience with this in VB? I have an example of C++ code which uses CodeDom, but I am a bit rusty with my C++!

View 4 Replies

Take A Screen Shot Of Full Code From Visual Studio Single File?

Mar 21, 2012

I want to take a screen shot of full code from visual studio single file. is it possible?

View 3 Replies

Getting An Error When One Of The Text Boxes Is Changed The Code Changes All Of Them Triggering Every Single Function To Activate?

Sep 23, 2010

The error it has is that when one of the text boxes is changed the code changes all of them triggering every single function to activate. Is there a simpler solution other then recoding it from the start? also each different Private Sub is identical basically.

Public Class Form1
Private Sub K_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles K.TextChanged
Dim T As Double[code]...

I know the code is very brute forced & sloppy but its the only way i really know how to do it.

View 2 Replies







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