Rewrite This Line Of Code To Be More Generic?
Sep 22, 2009
I got that line of code and it's getting duplicated a lot
myString = If(myObj1.myProp Is Nothing, "", If(want = "abr", myObj1.myProp.abr, myObj1.myProp.desc))
VS 2008 Remember Textbox Text when Form reopens
View 3 Replies
ADVERTISEMENT
Oct 23, 2011
I have some code that i have wrote earlier in VB.NET
Dim zippedLogFileName = f.FullName + ".gz"
Try
Using inputStream = f.OpenRead(),
[code].....
View 4 Replies
Oct 10, 2010
Trying to learn subs at the moment.I need to take the following code and rewrite it into subs.
Private Sub btnCompute_Click(...) Handles btnCompute.Click
'Convert feet and inches to centimeters
Dim str As String[code]....
View 14 Replies
Jan 26, 2011
How to rewrite the code below using select case? [code]....
View 8 Replies
Jan 15, 2012
I am using the given code to copy my database files...it works like a charm in debug mode but as soon as I create a setup, it stops working. The error is
"Database Detach Failed"
I tried checking the code line by line and found that the code does not enter the IF block.I have no idea why.
Public Sub bk()
Try
Dim strDatabasePath As String = My.Computer.FileSystem.CombinePath(My.Application.Info.DirectoryPath, "LIC.mdf")[code].....
View 2 Replies
Dec 16, 2009
We have migrated our Vb6 application to VB.NET using a third party tool. Now we are in a process of Refactoring and introducing object oriented concepts in the application.
In VB6, we were using structures in many places. As a part of introducing object oriented programming,
1. is it a good idea of changing all Structures to Classes? or Is there a concept of "Generic Structure" similar to Generic collections, Generic classes?
2. Can some one guide me any source containing guide lines or best practices for applications that are migrated to VB.NET from VB6 and implementing object oriented programmaing.
View 3 Replies
Jan 29, 2009
Is there a way to show the line number of the line of code that caused an exception within a Try...Catch block?
View 5 Replies
May 29, 2010
I am using WebBrowser1.DocumentText to get a websites source code, and then parse a string. I am trying to view the source line by line, and doing it as follows:
[Code]...
However what is displayed is each character from the source code, rather than the line. I am making the client log into a website, and the needed value from the source code is then parsed, so I need to use the WebBrowser type to get the source code.
View 2 Replies
Jan 20, 2010
show me a simple code for downloading a file from internet with a URL,Line by Line with streamreader?
View 6 Replies
Jul 9, 2009
You can do this
Code:
Dim Test() As String = {"Stuff", "Stuff", "Additional Stuff"}
Is there a way to do that with a generic dictionary? Also, is there a name for that?
View 4 Replies
Sep 2, 2009
I must be doing something wrong here (because really, what are the chances of me tripping over another bug in the Vb.net compiler?)I have a static generic function in .net 2.0 Vb code, I thought it was time to "upgrade" it to be an extension method, but the compiler complains with Extension method 'AddIfUnqiue' has type constraints that can never be satisfied.
Here's a trivial example that displays the same problem. The old static version (which works fine) followed by the extension method
Public Class MyStaticClass
Public Shared Sub AddIfUnqiue(Of T, L As {List(Of T)})(ByVal this As L, ByVal item As T)
If this.IndexOf(item) < 0 Then
[code].....
View 1 Replies
Jul 28, 2011
I'm trying to convert a batch of .pngs to .jpgs, as in this question:
[Code]....
The call to jpg.Save, however, with a "generic error" in GDI+. Originally outside of the innermost Using statement, I moved the call inwards as per this answer, but it didn't change anything. I have verified that newfile contains a valid path, and that the program has write access to the directory. What am I missing?
View 2 Replies
Feb 2, 2009
If anybody is having code for comparing files line by line using vb.net.
View 2 Replies
Dec 13, 2009
I have this string just down loaded of a Unix server. I would like to remove the box (0x0A) Unix end line code; then replace it with CR+LF normal ASCII code. Also, I would like to do the replace before I save the data, while it in memory.
View 14 Replies
Apr 13, 2012
Consider:
Public MustInherit Class Column
Public ReadOnly Property ReturnSomethingUseful() As Object
Get
'return something useful
[code]....
But this gives the following error:
Public Overrides Function ParseValue(sValue As String) As Boolean'
cannot override 'Public Overridable Function ParseValue(sValue As String) As Object'
because they differ by their return types.
I accept that you can't do this, but I'd like to be able to preserve the semantics of what I'm. trying to do, which is to have an untyped version that deals with Object, but a typed version in derived classes that knows about the specific type T.
View 2 Replies
Feb 12, 2011
This code:
vb Dim s As String = strContents '<a global variable) Dim currentPos As Int64 = 0 Dim endPos As Int64 = strContents.Length - 1 '// A dictionary, used to count the frequencies Dim characterCounter As New Dictionary(Of [String], Int64)() While currentPos <> endPos '//
[CODE]...
Gives this error: Value of type 'System.Collections.Generic.KeyValuePair(Of String, Long)' cannot be converted to 'System.Collections.DictionaryEntry'.
View 2 Replies
Aug 14, 2010
I have a Journal that records entries for different types: Journal(Of ParentT)
[Code]....
View 2 Replies
Nov 25, 2011
I am trying to construct a generic interface class with generic functions. My goal was to use this to implement multiple worker classes for database interaction that have the same basic functionality. Each class will deal with different object for example, category, product or supplier but unless the the functions in the interface are generic that this won't work.This is the interface code that I have but I don't know if I have done it correctly. [code]
View 2 Replies
Oct 12, 2010
So there is a program that is missing some files and written in C++, and it can no longer be compiled. Therefore I am trying to rewrite the program in Visual Basic (C++ is not my preferred language... lol) And I need some help understanding what this code is doing and how I can, in a way, "convert" it to VB language. I looked for a C++ to VB.NET converted but it costs $199 and I actually want to know what the code is doing... Here is part of the code for one of the C++ files (it is part of a program that decodes a file type into a readable format, BTW.):
[code]...
I want to know what is going on here and how I can recreate this in Visual Basic.
View 13 Replies
Mar 28, 2011
Currently I have to parse each row in the file into a string array segments(). Then I look at the first few elements to see where I am at. E.G.
'Patient Loop
IF Segment(0) = 'NM1' and Segment(1) = 'QC' and current loop = '2000' Then
PatientFName = Segment(2)
[code].....
View 9 Replies
Oct 28, 2009
How would I rewrite VB6 DefInt A-Z inVB.net?
View 1 Replies
Mar 7, 2009
I need a code that rewrite the Realmlist.Wtf file but before that it have to ask for the path to the file. And if its possible it have to remember the path, so if I click it again it automatically change it.
View 9 Replies
Jan 9, 2012
I'm new to programming and gave VB.NET a try. I (almost) finished a project (using VB.NET Express 2010) and now I'd like to rewrite it in HTML5 or CSS or Javascript or AJAX, or embedded Flash. Which one would you recommend? Which one as those 5 would be easier to learn for someone with some vb.net experience?
View 4 Replies
Jun 30, 2011
I am trying to create a list of a generic type in vb.net 2.0 framework.
This is the generic type definition:
Public Class GenericParamMap(Of T)
Public Sub New(ByVal pParamName As String, ByVal pPropValue As T)
mParamName = pParamName
[Code]....
The compiler does not allow a "T" in the method's parameter because it's not defined, but I'm not sure how or where to define it. I thought it was okay to have a generic method definition.
View 2 Replies
Feb 8, 2012
I am trying to write a generic method, to avoid code duplication, which will create or activate a Form as an MDI children, based on its type. But I have to lines in error (see comments).
[Code]...
View 4 Replies
Jan 4, 2012
I'm trying to rewrite a C++ library. But I have an issue. I'm not extremely pointer-savvy. In the C++ class there is a std::vector that holds unsigned int pointers (vector<unsigned int*>), and the int pointer just points to an array of integer data.
Here is the C++ code I'm a bit unsure about:
unsigned int* relocation = m_relocations.front();
m_relocations.pop();
unsigned int* reloc = *(unsigned int **)relocation;
View 3 Replies
Dec 6, 2009
basically the user enters phrases into the textboxes, and i use <TAG> in the text so that every time button is clicked the selected text is rewritten including a phrase from the textbox.
View 19 Replies
Jan 30, 2009
I read an image from the database and displayed it in a picture box...works fine...here is the code for that...[code].....
It throws an error on line 2 saying "A Generic Error occured in GDI+."
View 4 Replies
Apr 2, 2012
I'm trying to make some friendlyurls in my vb.net (.net 4) project and I'm trying to do it using something I read about global.asax and Application_Beginrequest but I can't get it to compile.
[Code]...
View 2 Replies
Apr 25, 2012
I'm using ASP.NET 4 / VB.NET / IIS to build a web application. Folks will access the web application via a URL like so: [URL] So, for example, here is the urls for Jane Doe, John Doe, and James Doe respectively: [URL] I need to somehow pass them off (no matter what name is entered) to a default.aspx page which then pulls in the name portion of the url and uses it to perform a lookup against the database which contains info. about this particular person and displays a personalized page based on that information.
[Code]...
View 1 Replies