New Line Inside ToString Function
Sep 8, 2010
VB.NET 2008. How could I make a new line inside the ToString() Function that VB already have. How to do like a .WriteLine() but inside the ToString() function. In my case, this inside of a class of course. I don't know if you get me. All I want to do is to show a fraction in the normal way not using the slash(/). Showing the numerator on top of a line, and below it the denominator. This inside the VB pre-made ToString() function.
This is what I've tried;
Public Overrides Function ToString() As String
Return Me.numerator & "/" & Me.denominator
End Function
Output example: 2/3
But this is not what I want.
View 4 Replies
ADVERTISEMENT
Jan 25, 2010
How can I call a function from inside another function and suspend the calling function until the called function is finished? I hope I can get some replies because I don't know how to ask the question and make sense:).
Anyway what I am trying to do in steps:
1. The user clicks button1 which triggers the click event.
2. From the click event I call a function
3. I then pop-up a form, that has instructions for the user to read.
4. After the user has read the form he will click the "Done" button and return to the calling function.
The problem is the the calling function continues to execute. I want to stop execution of the calling function until the users clicks the "Done" button on the instruction pop=up. I know I can use a msgbox but the instructions can be lengthly and does not look good in a msgbox.
I have tried the Call method with return in the "Done" button click but I can make that work. I also tried a goto statement but I can get that to work either. In the call statement I said call frmInstruction.show() and it got there but as I said the calling function continued to execute.
View 3 Replies
Mar 23, 2011
I arrive from years with Oracle plsql. Now I'm trying vb.net I created a function that return a char value, so written:
[Code]...
The question: I will create a function get_type(...) in vb.net that calls the tsql function written above... how can I call the tsql function [abc].[GET_PERSON_TYPE] in vb.net function get_type(...) function?
View 1 Replies
Oct 26, 2009
I would like to ask some questions related some functions i want to make in my program:
1. I am using this function in order to get a the item code from the database Long.Parse(myReader(0)).ToString("2200000000000") the result i get is: 2200000059091. The form that i want the resultset is
22 (fix value) + item code (6 characters right justified) + 00000 (fix value) 2205909100000 how should i change my code to obtain this result?
2. The programs every time it runs creates a text file which i also attached it plu1.txt, when i try to open it with notepad i see all the lines justified, on the other hand when i open the text file with Wordpad or ConTEXT the lines are not fixed, others are longer others are shorter? What should i change in my code in order to have every line fixed lenght... The code i am using is the following
Dim myReader As SqlDataReader = myCMD.ExecuteReader()
Dim fNextResult As Boolean = True
Using myWriter As IO.StreamWriter = New IO.StreamWriter("c:everest
[CODE]...
3. third and last question is that my program every time it ends show up a pop up menu which says "Text is created." Instead of this i would like to create a file lets say log.txt and every time the program runs, it will overwrite on the log.txt file a line like this: system date + Text is created + with X lines (where X are the lines of the text plu1.txt) ex. 26-10-2009 14:56 Text file created with 15 lines
View 4 Replies
Dec 16, 2010
1. What's the difference between ToString and ToString()? (i do know that ToString method is to cast numeric values to string but don't know how to get it to work)
2. Why do i need XML comment feature? is it necessary?
View 3 Replies
Aug 27, 2010
I am working in a form, and I had to this
Dim par1 as string = "something"
I want pass par1 to update sql statement, and I am not using AddParameter So, I had to add single quotes, the par1 will be
par1 = "'" + par1 + "'"
instead of doing the above, I was thinking in
par1 = par1.ToString.AddSingleQuote
or
par1 = par1.AddSingleQuote
Either to add "AddSingleQuote" to "ToString" method, or make it available for every variable of type "String" Can that be done?
View 2 Replies
Oct 15, 2009
I am trying to create a little script program in VBScript and I want to call some of the functions in wtsapi32.dll, can anyone point me to some sample code on how to do this? I am assuming that the values like: WTS_EVENT_ALL, are just plain simple literal strings, and not pointer to a variable inside of wtsapi32.dll.
View 1 Replies
Jun 9, 2010
I have drawn a circle and a line from the center of the circle to circle's boundary. Now I want to drag the line with its one end at center of the circle and the other end can be dragged along the boundaries of the circle to get the angles along the circumference of the circle..I dont know how to do it.
View 1 Replies
Aug 15, 2009
Module Exercise
Private Function SetMembershipLevel()
Dim MemberAge
[code].....
View 6 Replies
Dec 18, 2009
I'm trying to make an application that calls a function to create a timer, but I cant use WithEvents or Private inside of a function or sub, Is there any way to do this?
View 5 Replies
Aug 2, 2009
Public Module Exercise
Private Function GetFullName$(MI As String, _
LastName As String, _
FirstName As String)
[code]....
I want to know why the name of a sub routine is being used inside a Function Main as i have highlighted in bold letter.Canīt it stay outside the Function Main() just close to the Sub Program.? Example: -
MsgBox("Hello " & FullName)
Return 0
End Function
[code]....
View 5 Replies
Feb 24, 2009
I need to get a value from an API I made with ASHX and normally it is called from javascript but I need to call it right in ASP.NET I figured this shouldn't be a problem but I'm not sure the syntax.
View 2 Replies
Apr 11, 2012
Can anyone tell me how I close an opened SQL connection inside a Function?
I call a Select Function like this:
[Code]...
View 5 Replies
Oct 19, 2011
I'm trying to validate a form to be filled out by the users, and when the required section isn't filled, I increment an
ErrorCount += 1
variable to show that error(s) have occurred inside the program, I then also set an
ErrorArray()
to whatever the corresponding field number is, now I have 0-12 (13 fields). What I have also done is titled the labels that are associated with all of these fields to correspond with the ErrorArray() value that might be set, such as.
PatLabel0
PatLabel1 etc.
What I am trying to do is loop through the array contents, depending on which ErrorArray() values have been set, to go and set the corresponding fontcolor property of that label to red, to show that these now need to be filled out. This is what I have, but Visual Studio doesn't allow me to use the iteration through the loop as a reference to changing properties. Can anyone point me in the right direction to trying to figure this out, or at least tell me what else I could do. Just seems doing 20 if....then....else.... statements with 2 - 3 lines in each of them is redundant when 1 function line could do the same job. This is what I have.
for i = 0 to UBound(ErrorArray(12))
if(ErrorArray(i) = "*")then
PatLabel(i).forecolor = color.red
[code]....
that is basically all im looking for initially, but I can't do it.
View 1 Replies
Feb 24, 2012
I am currently facing an heavy struggle with architecturing my VB.Net app.To simplify, i'm using entries from XAML comboboxs, which all trigger OnChange the same routine which manages which Function(s) to use depending on which combobox triggered.The problem i'm facing is for example i have Function(ByVal A As String, ByVal B As Integer, ByVal C as Double, etc...), and it works if the routine calls explicitly for this function's result. But then if another combobox makes for example the variable B to change, then i have to add another "If sender= Then" check for this combobox and recall expicitly the function above (since B is one of its parameters)..In the end, my routine is loooooong like 24 checks with at least 4x duplicates of same functions..is there a simple way to make a Function autoexecute when one of its parameters change without having to be called explicitly by another routine ? (Like Excel formulas do when one of its references change)
View 12 Replies
May 21, 2010
I am trying to perform calculations on Regex substrings. I would like to do something like (see $2)
lblResult.Text = reg_exp.Replace(txtInput.Text, "$1" & "$2" * 0.039 & "$3" & "$4" & "$5")
I can only do this like:
For Each RxMatch In reg_exp.Matches(Me.txtInput.Text)
Me.lblResult.Text = Me.lblResult.Text & _
RxMatch.Groups.Item(1).ToString & _
Math.Round(CDbl(RxMatch.Groups.Item(2).ToString) * 0.03937, 4) & _
[code]....
View 3 Replies
Sep 22, 2011
I have written a function inside a class file which I added to my project in VB 2010 Express. Unfortunately, when trying to use this function in the main project, it cannot be seen by the compiler. The function is public. You can probably see from this that query that I don't know much about OO programming (I am assuming that the problem stems from something to do with this).
View 10 Replies
Jan 24, 2012
I have as sub that is triggered from the file system watcher when the new file is created in spec. directory.I need to call some function to do something with that file. [code]
View 6 Replies
Apr 6, 2009
this its a function i made to make sure all the fields on a form are filled before to save to database but once it finds a object it should exit. but it just doesnt... i tried also with exit for and exit sub also tried puting the exit for just after the msgbox shows up but it wont exit, this its the last thing i did using a flag but it doesnt exit either.
[Code]...
View 10 Replies
May 2, 2012
I am running into an issue with Array resizing in vb.net. I sort of understand why the issue is coming up but I'm not sure how to get around it. Basically, I have a class that has an array of objects being passed to it. I'm trying to have a sub resize the array and add another object to it. However, once it's done, the original object does not get updated.
Optimally I would like something like this.
Sub Main()
Dim parent As New Parent
Dim first As New Child()
[Code].....
View 3 Replies
Aug 5, 2010
I have a base class foo that will be used in multiple child classes of similar but slightly different function:
Public MustInherit Class foo
Public Function bar1() as Something
''// Perfectly OK to change what this method does
[code]....
How do I get the compiler to generate an error when bar2() is overridden by a child class?
View 2 Replies
May 20, 2009
I wand to Expose a function inside a module in my Class Liberary( DLL)
module Module1
Public Function Add(val1 , val2) as double
return val1 + val2
End Function
End Module
View 7 Replies
Dec 13, 2010
I created a function that retrieves information on which checkboxes are checked. It returns an array which the information coupled to the checking of those checkboxes. Those checkboxes and the matching textboxes are dynamically created at runtime in that same function. I'm pausing the application to wait for a button to be pressed. I'm trying to find a way to use btnDone.Click event directly because the code always reloops my function once more recreating the controls.
Public Function GetArray(ByVal strDLFolder As String) As Array
If blnDone = False Then
Me.Show()
[CODE]..........
Right now I'm setting a create a boolean switch when btnSubDone is clicked. What I would like is for something along the lines of:
[CODE]...........
Is it possible to use events like this? If not is there a cleaner way for pausing the application to wait for a button click (one that doesn't run the entire function again)?
View 2 Replies
Aug 12, 2010
I have a button inside a one of my forms which contain a lot of coding and normally a lot of variables declaration.
Is there is a option/add-on that I can use/set that enable me to display all the variable used inside the sub or function I am currently working in?
All I can find is add-on to display the Properties/Methods and only Public variables inside the form or inside the class. but I need to list the local variables also.
View 8 Replies
Nov 21, 2011
I have a GridView which is continually rebound using a timer and is within an updatePanel so the page doesn't refresh continually (each row has a countdown sequence so the gridview needs to continually get updated). Inside the gridview i have an imagebutton with an OnClick method. Previously to get the OnClick method to fire I would make sure the gridView wasn't in an UpdatePanel and that the pageload databinding of the gridview was in an "If Not IsPostBack". With the Timer though I can't have the gridview binding an an "If Not IsPostBack" and it needs to be in an UpdatePanel. Is there a way to use an UpdatePanel and "If Not IsPostBack" and still get the OnClick method to be called?
Here's some of the code, if my explanation didn't make complete sense:
UpdatePanel/Timer/GridView
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Timer ID="timerCountDown" runat="server" Interval="1000" OnTick="timerCountDown_Tick"></asp:Timer>
[Code] ....
View 1 Replies
Oct 5, 2010
So if I create an object test, and it has a property color. When I add this object to an array list I typically can access this using myarray(0).color but intellisense doesn't 'know' that I have a 'test' object inside the array. It would let me type myarray(0).whatever but would then crash if I made typo. It seems like I should be able to let it know what type of object I am trying to work with inside the arraylist. In code maybe something like this
[Code]....
View 1 Replies
Oct 23, 2009
How do I create a function to copy and image from a picturebox to another inside the form. Or from a picturebox to a coordinate place inside the form.
View 12 Replies
Jun 26, 2011
I am having a toolstrip in the mdi form which contains save, update delete and clear buttons. The child form is having save, update, delete and clear as public sub routines , and client form will not have any standard buttons, I will click the respective button in the parent tool window which should call the child forms function.
View 1 Replies
May 13, 2009
I have a module1.vb that contains a public sub, for example
Public Sub LogEvent(ByVal strIn As String)
Dim objLogFile As Object
objLogFile = frmEventLog.txtLog
[code].....
View 15 Replies
Jul 28, 2009
i have a question in vb about inside a data grid view i need to create a combo box...
View 1 Replies