Interfaces - Adding Code To A Sub Or Function
Jan 14, 2010
In using the IDisposable Interface, the two subroutines are displayed in my code from Microsoft when coded. How do I do the same with an Interface that I write? Is it possible or is this a feature that only Microsoft can do? I am using Visual Studio 2005!
View 7 Replies
ADVERTISEMENT
Oct 20, 2011
I have a solution with multiple projects, some of the projects are written in VB, some in C#. I am wondering if there's a way to use interfaces and/or enums written in VB in C# classes? My C# code below doesn't compile, however I am able to see the interface in intellisense.
[Code]...
P.S It's a console/service application, not ASP.Net (where I know it's doable).UPD: Sorry guys, was missing a reference to the project with the interface. It's fixed now. I think the thing that in VB projects references are done slightly different than in C# confused me.
View 2 Replies
Apr 9, 2009
I just started playing around with interfaces recently and I have a couple things I want to ask. First off I always understood that an Interface cannot contain code, you are merely creating almost a "template" of methods, property's etc...Lets say I have this:
Public Class MyTest
Implements IMyTest
Public Sub iDispose() Implements IMyTest.iDispose
[code].....
View 3 Replies
Dec 13, 2011
I need to execute a stored function in oracle or sql through vb.net. I created a command object. Depending on the database type(oracle or SQL) i am preparing the Command text as Select functionName(?,?,?,?,?,?,?,?) from dual; (For Oracle) Adding the parameter values of the function. Now performing the ExecuteScalar which is not working saying invalid parameter. This works with ODBC connection string. But ODBC doesn't with 64bit. My Requirement: Code should execute a user defined stored procedure by taking the values at runtime.
View 1 Replies
Jun 14, 2012
Possible Duplicate:
calling ASP function from javascript
okay running this code :
<script type="text/javascript">
[code].....
View 2 Replies
Jul 3, 2011
This is my first time writeing a program and i am stuck. i am just looking for were i should go next. i can't figure out how to write in code for the days in the getDay function.
Write a program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule:
a. Any call started between 7:00 A.M. and 9:00 P.M., Monday through Friday, is billed at a rate of $0.30 per minute.
b. Any call started before 7:00 A.M. or after 9:00 P.M., Monday through Friday, is billed at a rate of $0.15 per minute.
c. Any call started on a Saturday or Sunday is billed at a rate of $0.10 per minute.
The inputs will consist of (1) the day of the week, (2) the start/end time of the call, and (3) the length of the call in minutes. The output will be the cost of the call. Input will come from the user and outputs will be displayed via the console window.
Module program1
Sub Main()
Dim day As String
day = GetDay()
[CODE]...
View 5 Replies
Nov 26, 2009
Is it possible to make your own function for a String? So you could do this:
Dim String a = "C:Windows"
if a.Exists then 'do something
Is it possible to make your own .Exists?
View 7 Replies
Nov 16, 2009
I am trying to add a new global function
I am doing it like that:
Function MessageYNC() As String
{
return "dd";
}
[Code].....
But i am getting error -> Statement is not valid in a namespace. on the first line
View 2 Replies
Jul 9, 2010
I am writing a chat program and im adding a transfer file function but Ive hit i bit of a snag..The way my program knows its a file coming and not a regular text message is i added a 3-6 bytes prefix depending on what is being sent.
[Code]...
Ive tried the copyto method but since my file byte array is empty it throws an exception. If i wasn't clear with something let me know and i will try to explain better.
View 1 Replies
Jun 16, 2009
In the software I am developing for my A-level computing coursework I want to add a function to export the database (to backup, use in other computers, etc) and later on a function to import databases (that I had previously exported using this function). At the moment I have a SaveFileDialog, and I have filtered .mdb files only (as this is the type of files supported by my application). But How do I select what is going to be saved? (How do I point to the .mdb file that is located in the program's directory?)
View 12 Replies
Oct 23, 2010
I'm fairly new to learning visual basic. I'm trying to create a program that dynamically generates a EXE file that performs mouse movements and keystrokes. To dynamically generate EXE files, I am using the CODEDOM API for Visual Basic.
[Code]...
View 2 Replies
May 12, 2012
I have an XML file and I have a function to which this XML is passed as string. I have loaded this string in Xmldocument and I need to insert few children nodes under one node. This function returns the modified XML string. I want that whenever this function is called, new child nodes are added, currently, It adds child nodes once.Do I need to overwrite the XML file ? If so, How can I replace the node with new node ( with new child nodes added) so that It has child nodes added before the function is called again ?
My code looks something like this:
Dim doc As New XmlDocument
doc.LoadXml(applicationXml)
Dim parentNode As XmlNode = doc.GetElementsByTagName("prList").Item(0)
[code]....
View 1 Replies
May 17, 2010
I have a function that converts a .csv file to a datatable. One of the columns I am converting is is a field of names that have a comma in them i.e. "Doe, John" when converting the function treats this as 2 seperate fields because of the comma. I need the datatable to hold this as one field Doe, John in the datatable.
Function CSV2DataTable(ByVal filename As String, ByVal sepChar As String) As DataTable
Dim reader As System.IO.StreamReader
Dim table As New DataTable
Dim colAdded As Boolean = False
[Code]...
View 6 Replies
Oct 18, 2011
CODE:
I have tried a million times to gt this funtion working and i cant.
View 3 Replies
Jan 7, 2009
i have search for tutorials but none seems to work for me.This is my app code Public Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
[Code]...
As you see, "button2" renames files to backup, and "button3" renames them back to original name.How can i make dir (C:Program FilesRockstar GamesGTA San Andreas) a variable?And maybe when app starts it lets user to select their program path (browse function) then it will but their selected path to variable, and i can use this variable in my code as path?
View 5 Replies
Jul 6, 2010
In the exam paper, student have to check the checkboxes [usercontrol does not work] whether the question is correct or wrong.Now as I have hundreds of questions, I cannot write the same code again and again with the IF conditions, is there anyway to make it a function or something then call it whenever is needed.As well as I wanted the marks to be added when a student submits the paper.
View 5 Replies
Oct 21, 2010
I am looping through all folders on the computer in a background worker. Starting with just the C: drive, the function works perfectly I've been tasked with adding recursiveness to this function to loop through all subfolders within each and every folder.
This is the working code without recursive. Startpath is set = "c:".
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim fs As New FileSystemObject
Dim fsfolder As Folder
Dim subfolder As Folder
[Code]...
EDIT: I was doing some testing and threw in an if check to skip the C:$ folders. Working ok so far and noticed something really strange. It doesn't loop through all the folders in the C: drive. I think it will loop through only the first 2 folders. One is C:Boot so I skip that and the other is C:Dev-cpp. It won't loop through the Program Files, Program Files (x86), or Users.
View 4 Replies
Sep 19, 2009
I am pulling information out of my Access Database and reading to a webpage. I need to add a update, delete, and email function to this page. I am trying to do this with the selection of a check box and buttons for each one. But I am unable to get the delete to do anything but redirect back to the orignal page. For the update I want to be able to pull the info in text boxes and just change the info and click update and it gets changed. I also want to be able to pull their email from the database and put it into a text box to be able to email right from the page. Code for show page and delete page below.
[Code]...
View 1 Replies
Jan 4, 2011
This sounds like the stupidest question ever!!! BUT what is the code for adding a number to a label with the label's value being calculated dependent on user input?! So you choose 2 numbers to multiply, If a box is ticked then you add 10 to the label. I've got everything else I just can't work out the structure/code for this little bit.
View 1 Replies
May 26, 2009
I have the below code which will send xml to me website when Button3 is clicked:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Button3.Click
If RichTextBox2.Text = "Please enter the XML Data" Then
[code].....
View 4 Replies
Feb 17, 2011
I hope you can tell me what is wrong with my code. I have tried this code below, And when the my requirements are met. the messageBox keeps loading, for as long as my requirements are met. (I get hundreds of messageBox's). I am using Visual Basic 2010.
Basicaly when a progressBar1 reaches a percentage I have Stated I what a MessageBox to show a message. and because the message is long would I add vbNewLine where I have Underlined.[code...]
View 4 Replies
Jan 17, 2012
I am working on adding some ajax controls for either a hover menu or popup control. But when I do I get the following code.<System.Web.Services.WebMethodAttribute()> <System.Web.Script.Services.ScriptMethodAttribute()> _
Public Shared Function GetDynamicContent(ByVal contextKey As System.String) As System.String
End Function I am trying to find out exactly how to code against this function. I am at a bit of a loss with regard to the WebMethodAttribute, and ScriptMethodAttribute, one would think I could delete one or the other. I watched numerous videos by MS and others and this code behind is not covered.
If someone could point to some tutorials, MSDN, white papers, or web sites where this is used, or in a project or something,
View 1 Replies
Aug 14, 2011
I am trying to create and remove a series of controls programatically. The user will have a numeric updown to pick a number. The program will then create a bunch of duplicate controls based on whatever number they pick on the fly.
Public Class Form1
Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numberDebts.ValueChanged[code].....
The creation part works just fine.As the number is toggled upward a new label is created.However whenever I remove labels it acts very strangely.The first time I bring it down it works just fine. Then the next 3 do nothing but the 4th removes another line.I can also toggle back and forth and it will eventually remove the label. So for example.
Starts with 1 selected - 1 label visible (1)
Change to 2 - 2 labels visible (1-2)
Change to 3 - 3 labels visible (1-3)[code]....
If I toggle back and forth between 2 and 3 eventually label 4 will go away.I want only 1- my numeric up down value to be displayed and have everything else after that removed.
View 5 Replies
Dec 13, 2010
I am creating an application install program, but one of the main things i cannot get working is the combobox, this is a drop down list of all my applications that i have put in there. I was wondering if there was a way you could tell the combobox to look at a directory or share and list the names of files within it? So, for example i could place 5 programs inside a share or directory then when i run the program and the click the drop down combo the 5 programs are listed and then i can click and install this program. Also then if i add/remove any programs it also removes it from the combo list.
View 10 Replies
Mar 3, 2010
I have made it so that as soon as the form opens it puts an icon in the tray and when you right click the icon it comes up with a contextmenustrip. in the form I have put a button and a textbox. when you click the button, it creates a new item in the contextmenustrip What I wanted to do was add a peice of code to this new item, is this possible?
View 9 Replies
Sep 13, 2011
i am in runtime mode and have a form open. I do some calculations on it and based on those i generate some lines of VB code (concatenated and saved in a local variable). Is there a VB command that i can use that will take this code and INSERT it into another form?
i could copy the code, exit runtime, go to design mode and paste it into the form myself but because i want to do this for several subs for a lot of forms then it will become very time consuming.
View 7 Replies
Feb 6, 2011
I want to custom code to a report. For example, I have a text box, txtABC on the report. I want to assign it a value from variable, when report runs. How to do it.
View 1 Replies
Jun 15, 2011
I have a web form but I have to do this by code since I dont know the number of hyperlinks I need from the beginning.How can I add some hyperlinks with Image in a label, the number of hyperlink depends on the number of rows of a query, and each row give me the link information to navigate.
View 2 Replies
Sep 9, 2009
I am using ASP.NET with MasterPages. Thus i cant just place this link in my pages that reference my MasterPage.
<link rel="canonical" href="http://www.erate.co.za/" />
I need to place this link in though my Page Load of each one of my pages. How would i do this through code? I am using VB.NET but C# will also help me in the right direction.This is how i did it for my DESCRIPTION tag in my code behind.
Dim tag As HtmlMeta = New HtmlMeta()
tag.Name = "description"
tag.Content = "Find or rate any company in South Africa for FREE and rate them"
Header.Controls.Add(tag)
View 6 Replies
Jan 24, 2012
Today I'm facing the problem of adding code when the program is running.I know i can execute command, (like when i press button1 it does the command in textbox1) but I want the code to be saved.Using the setting or resource tab is not an option, (don't ask why).
View 2 Replies