C# - What Are The Different Methods For Injecting Cross-cutting Concerns

Nov 10, 2009

What are the different methods for injecting cross-cutting concerns into a class so that I can minimize the coupling of the classes involved while keeping the code testable (TDD or otherwise)?

For example, consider if I have a class that requires both logging functionality and centralized exception management. Should I use DIP and inject both required concerns via an interface into the class that requires them? Should I use a service locater that I pass to each class that will require some cross cutting functionality? Is there a different solution altogether? Am I asking the wrong question entirely?


.net - Performance Concerns Of Instantiating Multiple Classes In One Form?

Nov 6, 2009

I would like to know how will performance go when I instantiate multiple classes in one form.e.g

Public Class frmClass
Dim obja As New ClassA
Dim objb As New ClassB


View 3 Replies View Related

Performance Concerns Between DataTable And SqlDataReader To Fill Data With FlexGrid

Nov 5, 2009

Which one is more faster between DataTable and SqlDataReader while I'm trying to fill Data into FlexGrid with VB.NET?

View 3 Replies View Related

C# :: Injecting A DLL Into A Target Process?

Feb 21, 2011

I recently wrote a quick VB.NET app that injects a DLL into a running process. To test it I was creating my own vb.net Class Library project which simply spawns a "Hello World" message box in hopes of it showing up in the target process once I injected my HelloWorld.DLL.My problem is that the message box never shows up after I inject the HelloWorld.DLL. I'm pretty sure the reason for this is because once my HelloWorld.DLL is injected (since it's a VB.NET DLL) it does not have a DllMain and hence has no idea what to execute and nothing happens.

View 1 Replies View Related

VS 2008 Injecting A DLL From My.Resources?

Oct 29, 2009

It highlights the text in bold and gives me Error1Value of type '1-dimensional array of Byte' cannot be converted to 'String'.

View 14 Replies View Related

.net - Injecting Into Games (Similar To XFire)?

Apr 19, 2011

How does xFire place itself inside of games?

View 1 Replies View Related

Asp.net - Injecting Server Side Variables Using <%#

Jul 26, 2010

I was having problems inserting a string into the following tag : <tr id="rowBulkOptions" style='<%# sBulkOptionsRowStyle %>'> Don't ask why I'm using tables sBulkOptionsRowStyle is a Public string in the aspx.vb file. Seemingly the only way I can get this to render is to put Page.DataBind() in the Page_Load, Page_PreRender etc.. However this causes me problems because Page.DataBind() binds all controls on the page. I could use <%= BUT another part of the code inserts controls into the page and apparently you can't use <%= and insert controls.Is there a way I can just say 'look, put sBulkOptionsRowStyle into the page

View 1 Replies View Related

.net - Injecting A VB Parameter Into A Stored Procedure (FireBird)?

Mar 17, 2009

Everyone here has always been such great help, either directly or indirectly. And it is with grand hope that this, yet again, rings true.For clarification sakes, the Stored Procedure is running under FireBird and the VB is of the .NET variety


View 3 Replies View Related

VS 2010 Parse & Injecting Code Into Webbrowser

Jun 15, 2010

I am having trouble injecting code directly into a webbrowser control.I am trying to search for:<param name="bgcolor" value="#869ca7" /> in a webpage and replace the value with my own to change the color of the page background..[code]Object reference not set to an instance of an object.

View 3 Replies View Related

Mvc - Repository Pattern Implements Methods By Adding Add1 But Should Use Methods Of The Baseclass?

Aug 29, 2011

This is the original code in c#

public class CategoryRepository: RepositoryBase<Category>, ICategoryRepository
public CategoryRepository(IDatabaseFactory databaseFactory)
: base(databaseFactory)


Does anyone has an idea what i should change to let it work and let my UserRepository use the methods in RepositoryBase while implementing the IUserRepository?

View 1 Replies View Related

Cutting Up A String?

Jan 27, 2010

Builting a calculator.  I have a string of two numbers separated by an math sign.  Knowing the length of the first number then adding one for the sign will produce the start length of the second number.  Trim the original string to get what I need.

dim num(25) as double
dim length,length1 as integer
dim string, string1 as string
length = Len(num(n - 1))
length1 = length + 1


View 3 Replies View Related

Cant See Available Methods List When Write Object.METHODS?

Jun 24, 2011

I am working with a vb program, but there is something strange on one of my .vb code pagewhen i put the "dot" afther the object name its dont show the methods availables for this objectbut on other vb code pages i can see it. but in this one no.for exmaplethis is a piece of code: Dim sb As New StringBuilder()

View 3 Replies View Related

Making Class Methods Instead Of Instance Methods In .NET?

Mar 29, 2010

I am not sure how clear my question is by the title, but I am trying to make Class methods instead of Instance methods in Visual Basic that way I don't have to waste memory and code creating temporary objects to execute methods that don't need instance variables.

I am not sure if you can do that in VB but I know you can in Objective-C by using either a "+" or "-" sign in front of the method declaration. And in C++ (at least I think, I can't remember) you put the static keyword or const keyword in front of the function.How would I do this in VB if it is possible? Or should I just make a separate set of functions that are not members of a class?

View 2 Replies View Related

.net - Cutting Off The 0's At The Front Of A Record?

Feb 6, 2012

Basically, I have an Access database with Primary keys that are structured with this format ("02"000).When I try to paste the number, it ignores the "02" and goes straight to 000.For example, here is the code;

PeriodRoomID.Name = ("R" & ds.Tables("sqlSpecRoomRequest").Rows(i).Item(1))

What PeriodRoomID.Name should be is R02001.What PeriodRoomID.Name comes up as is R1.It ignores the "02" and ignores the 0s. This makes sense mathematically but it is not what I want. I need a way to get the exact output and not some simplified version.

The query;

SELECT SpecialSoftware.SpecSoftID, SpecialSoftware.RoomID, SpecialSoftwareNames.Description, Rooms.Capacity
FROM SpecialSoftware, SpecialSoftwareNames, Rooms

View 3 Replies View Related

Cutting A String Into 2 Strings?

Jun 25, 2012

I must input a letter and a number in a text box.. say "A14", and them I want to cut the string into "A" and "14" and then use these, but I do not know how to code this as the next string could be "A1" or "C110" and these change... could I make an if for each one? like an if for when its 2 characters and just cut it in half and then an if when its 3 characters and cut between the 1st and second and so on?

View 4 Replies View Related

Cutting Long CommandText?

Sep 7, 2011

What is wrong with this code?When the code runs cmd.ExecuteReader I get an error saying "Incorrect syntax near the keyword 'AS'".I'm assuming I didn't breakup the sentence correctly.

Using cnn As New SqlClient.SqlConnection(clsDBConn.clsDBConnections.prpConnString)
Using cmd As New SqlClient.SqlCommand[code].....

View 4 Replies View Related

Cutting Off Digits And Rounding Up/down?

Jul 22, 2010

I need a function that takes a decimal, with a certain number of digits behiond the comma and convert it to a string with a different number of n digits behind the comma. (to display it)My problem is the rounding ip/down.

like 123,789 with n = 2 --> 123,79
or 123,4 with n = 0 --> 123
or 123,5 with n = 0 --> 124

I did not find an existing function that does that, so I wrote one myself.However the code has become soo complex and it still does not work well, and I get frustrated to spend soo much time with something so trivial.Does anyone know a function that can do this? There must be something out there.

View 4 Replies View Related

Cutting A String Without Half-words?

Aug 8, 2003

I need to display the first c.200 characters of a longer string, for the homepage of a news website. I am using VB.NET. Obviously, cutting exactly 200 chars quite often cuts a word in half, e.g.: "The last five years have seen a radical increase in the volume and complexity of company legislation. The Bahamas has established a Stock Exchange, passed legislation aimed at regu" I need a function that will produce: "The last five years have seen a radical increase in the volume and complexity of company legislation. The Bahamas has established a Stock Exchange, passed legislation aimed at" I can then add "... [More]" or whatever to the end of this string and voila! Is there any way of using regular expressions (regex), substr or something similar to produce this output?

View 2 Replies View Related

Cutting Off A 0 In VB 2008 - Populate A Combobox ?

Sep 17, 2009

I am trying to populate a combobox using the following code.


View 2 Replies View Related

.net - Cutting Up Large XML File Into Small Chunks?

Jan 30, 2011

I have a large wikipedia dump that I want to cut into different files (1 file for each article). I wrote a VB App to do it for me, but it was quite slow and crapped out after a few hours of cutting. Im currently splitting the file into smaller 50mb chunks using another app but thats taking a long time (20-30 minutes for each chunk). I should be able to cut each of these up individually if I do this.

Does anyone have any suggestions of a way to cut this file up quicker?

View 4 Replies View Related

Interface And Graphics :: Cutting Text From RichTextBox?

Feb 15, 2011

I want my Richtext box to be populated with a text string that contains HTML-style tags to set colour, underline etc.When I try to remove the tags using .cut(), the first cut always works, the second cut only sometimes.Here's a sample to test it:Create a new project and add a button and a richtext box.Add the following code:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim testString As String = "ABC<R>DEF</R>GHIJKL"


This code works fine.The text between the tags is turned red, then the tags are removed.Now rem out the msgbox line and run again.Sometimes it works, sometimes the second cut fails with no message or warning.I am using Visual Basic 2010

Visual Studio 2010 v 10.0.30319.1
.NET framework v 4.0.30319

View 4 Replies View Related

Parse A String To Specified Length (without Cutting Words)?

Jun 24, 2009

I have a long string that I need to parse into an array of strings that do not exceed 40 characters in length. The tricky part of this for me is making sure that the regex finds the last whitespace before 40 characters to make a clean break between strings since I don't want words cut off.

View 2 Replies View Related

Variables 'hiding' When Cutting And Pasting A Groupbox?

Mar 29, 2011

I'm working with the graphic designer in Visual Basic 2008 Express Edition. I tried to cut and paste a groupbox and the variables reverted to standard ones (CheckBox123 etc.), and when I tried to change them back to their proper names, I got an error message stating that this name is "already in use by another component". But this is nowhere to be seen anywhere in the "Form1.vb[Design]". How do I either get rid of these "hidden" variable names or reunite them with the groupbox they used to belong to?

View 8 Replies View Related

Cutting And Adjusting A Picture Size When It Is Uploaded Through Picturebox?

Jun 17, 2009

Does anyone has a sample code or idea for cutting and adjusting a picture size when it is uploaded thru picturebox?

For example..

1. Picturebox size on winform = 150*150

2. A picture size = 1024 *800

3. I want to be able to cut 150*150 out of 1024 *800 and upload it. I wish the cutting and adjusting size is possible thru winform.

View 3 Replies View Related

VS 2010 - Events Being Unlinked When Cutting / Pasting Controls

Mar 27, 2012

Let's say I cut a tab control with buttons on it and paste it into a Panel control. After doing this, all my control events are being unlinked from the event code. I have to manually relink all the events in the Properties window. Is there any way round this?

View 15 Replies View Related

VS 2010 Reading / Cutting And Pasting Within One Excel Document.

May 22, 2011

Basically i work as a desktop support officer. our team does everything from fixing software errors on PCs in the office to moving them from one desk to another. When we do have to move anything though, it needs to be tracked so that our records can be accurate. To track where things have moved to, we have to:

1. fill out a form in an excel format and then fill out the same information into a text file format, and then attach both formats to the job record in our job listing system and send it to our hardware tracking team.

2. If an asset is being taken away to storage, but is considered to be too old, it needs to have an excel table filled out to create a 'disposal' label, or it can create a 'redeploy' label if it still has some years left in it.

3. If we are putting out a brand new asset, it needs to be updated on our tracking sheet to show that the asset is no longer in our storage as brand new.

This obviously creates a lot of administration work for our staff, so i have built my program to take all the information required once, and then split it off to the forms and labels as required.The part I'm stuck at is number 3. I have been working with the excel files in the following format:[code]What i need to do is as the title suggests, search an excel work book (the user will point to it) for the Asset Number in a particular sheet. Once it finds the asset number, cut the entire line out of the sheet and paste it into a different worksheet at the next empty line with a few edited values.

View 1 Replies View Related

VS 2008 "injecting" JavaScript Into HTML Page?

Dec 8, 2009

I was wondering, is there a way to inject certain JavaScript code into HTML page loaded in webbrowser

(function () {
var css = "#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade,.gbh { opacity: 1 !important; filter:alpha(opacity=100) !important; }";
if (typeof GM_addStyle != "undefined") {


View 10 Replies View Related

2 Different Methods Using Same Object Methods?

Aug 26, 2010

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim someproc As Process


View 3 Replies View Related

Trimming Text / Cutting Particular Text

Apr 30, 2010

I am making an app that reads some source code of a html file and then cuts a part of text and store it in a variable. Here is an example of what i mean: [code]So then i want to store the text in between the <p> and </p> tags.

View 13 Replies View Related

.net - 'cross-referencing' DataTable's?

Jun 15, 2010

I have a DataGridView that is being filled with data from a table. Inside this table is a column called 'group' that has the ID of an individual group in another table.

What I would like to do, is when the DataGridView is filled, instead of showing the ID contained in 'group', I'd like it to display the name of the group. Is there some type of VB.net 'magic' that can do this, or do I need to cross-reference the data myself?

Here is a breakdown of what the 2 tables look like:

group (this holds the value of column id in table 2)


BTW - I am using Visual Studio Express.

View 1 Replies View Related

C# - CRC For Cross Platform Applications?

Apr 19, 2010

I wish to use common CRC logic in a VB.NET or C# application as well as on a C/Linux application. I have one C/Linux application that interacts with a webservice (written in C#) and also a web application (written in VB.NET). For some data, I want to add a CRC to the data itself (say a file) from the .NET side and check for the integrity of the data (checking the CRC) on the client - and also vice-versa.

View 2 Replies View Related

C# - Cross Platform Alternatives To WPF?

Mar 31, 2011

I'm thinking of porting my application from VB.net to the C# based MONO project, so it can run on both Windows and Mac. However, I am in need of a Mac-friendly alternative to WPF. It has to have very similar functionality. QML (by QT) is not a viable option, as it costs far too much money for us.

View 3 Replies View Related

Create A Cross-platform DLL In .net?

Aug 4, 2009

I have a interesting problem: Where I work we've built a home-grown ERP system in VB6 that we are slowly moving over into vb.net. There are some projects have are in .net: we have a hand-held C# project that uses a web service to talk to our database, I've built some reporting screens using Crystal and some smaller maintenance screens.

Well as we have been plotting the conversion out, we want to have a way to separate our business logic and UI so that the UI can be a win/web form or a Smart Device project. Is this even possible? I try to reference the DLL in a test I have and it gives me this error when trying to debug using a emulator Deployment and/or registration failed with error: 0x8973190e. Error writing file '%csidl_program_files%smartdeviceproject1system.windows.forms.dll'. Error 0x80070070: There is not enough space on the disk.

View 2 Replies View Related

Cross Link Two Different Threads?

May 4, 2010

this is sumit from Larsen & Toubro Mumbai-India,I am writing a code for some sort of software in which execution of some code is required as soon as my software receive a barcode from barcode scanner (serial input). Now through datareceived event handler i am able to read the barcode but after that i am not able to send this barcode to any textbox or even i am not able to start any other event like performclick to any button or anything. I am getting an exception as cross linking of threads not possible. please refer to the image and give me the solution asap.

View 2 Replies View Related

Cross Reference A .contains For Two Textboxes?

Jun 10, 2009

How can I cross reference a .contains for two textboxes? like

for each word in textbox1.text
if textbox2.text.contains(word) then
msgbox("There was a word found that should not be there",msgboxstyle.critical,"Invalid")
end if

Would I need to do a RegEx to get every word in the textobox? Or should i just use a listbox and do a for each I as item in listbox1.items?

View 1 Replies View Related

Cross Thread With A Backgroundworker?

Jan 27, 2010

im sorry if this has been asked before.but i couldent find it in my first look i have a form that runs a query on a mysql database but as it runs the query the form stops responding till it finishes sooo i had the smart idea of putting it in a back ground worker..

GREAT i thot i had it working it all seemed to go greeat then i noticed when i try to change the label text on the form to corispond to the info it got... it wont work it give me a cross threading error....

how to cross thread between the back ground worker and the origial form..

View 2 Replies View Related

Cross Threading On A Property

Dec 1, 2010

I have this situation where I want to set the visibility property on the form but I have a cross threading issue. I have coded it like the following but is it possible to achieve it on the property on itself.


View 2 Replies View Related

Cross-Threading And Listbox?

Dec 15, 2011

I've problem with my application. I have one class frmMain, where I have one Listbox. I'm developing a separate class that lunches a couple of threads. They do some work, and in the end I want to show the data in the frmMain listbox. I'm using the following code:

One sub that handles the requests to the Listbox. I declare it in Module

Module Functions
Public Sub ChangeText(ByVal ctrl As ListBox, ByVal str As String)
If ctrl.InvokeRequired Then


View 11 Replies View Related

Cross-threading Between Forms?

Aug 8, 2010

I have an application with two forms - a splash form and the main form. The main form reads an XML file and displays data from the file in a rich text box. While that is happening the splash form is displayed. When the main form is ready to be displayed the splash form closes and the main form is displayed. I have a progress bar on the splash form to inform the user of the progress of the load. I want to set the maximum value for  the progress bar to the number of elements in the XML file. In the main form I am using a reader to count the number of elements. After I get that number I wan to update the maximum on the progress bar control so it displays correctly. That is where I am getting the cross threading error. Now I could do that in the splash form. But where the real issue lies is I want to update the progress bar value every time I read an element in the main form process to read the XML file. That I don't think I can do in the splash form as it would duplicate the process of the main form and defeat the purpose of the splash form.

I have researched this issue but can't find an answer. I have tried the delegate route but I still get a cross-threading error. I assume that is because I am cross threading across forms.

View 1 Replies View Related

Raise Cross Threads?

Apr 5, 2012

I am getting this error: Unable to cast object of type 'SGA.AppContext' to type System.ComponentModel.ISynchronizeInvoke'.I am not using a start up for my project but a sub main() and a threaded class AppContext

View 14 Replies View Related

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