|
How do u make a new line in text box programmatically in VB.NET?
I was hoping to use C++ format code "\n":
For i = 0 To (Count - 1) Step 1
txtMsgBox.Text = txtMsgBox.Text.Concat("\n" & lstContactList.SelectedItems(i).Text & txtMsg.Text)
Next i
But no, it didnt work.
Thanx
norm
|
|
|
|
|
You can use :
<br />
txtMsgBox.Text=txtMsgBox.Text+ vbCrLf + "NewString"<br />
as vbCrLf = \n in VB
make sure that :
<br />
txtMsgBox.MultiLine=True<br />
|
|
|
|
|
Actually vbCrLf = \r\n, Carriage Return (Cr), Line Feed (Lf)
vbCr = \r
vbLf = \n
Jason Gerard
|
|
|
|
|
Try CrLf Carriage Return and Line Feed characters.
use one every time you want to start a new line.
|
|
|
|
|
All the previous versions of VB could not support MAPI to its fullest. Can VB.net?
If not is there any alternative for creating a complete email program with VB.net other than CDO?
|
|
|
|
|
hi, how can i use SetTimer in a class, i keep getting these errors:
Invalid use of adressof operator
my code is:
lngTimerID = SetTimer(0, 0, 200, AddressOf mysub)
Public Sub mysub(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
Dim retval As Long ' return value
objWinSock.SendData ByteCode & "rcon " & rconNumber & " " & s_pass & " " & s_command
objWinSock.Close
Set objWinSock = Nothing
retval = KillTimer(vbNull, 1)
End Sub
|
|
|
|
|
In VB6, the AddressOf operator can only be used for procedures in a module, not a class. To see how to work around the problem, look here.
|
|
|
|
|
Hi, I wish to build a control that resembles those panes, "ToolBox" for example, that "slides" into the view when click on the tab.
1. Is there a name for these controls?
2. Any idea how to build them?
3. How can I set a "control" opacity? Can I control individual individual "control" opacity as suppose to controlling dialog opacity?
Something similar to what u can see at bluetooth site:
http://www.bluetooth.com/
Thanks!
norm
|
|
|
|
|
I'm working on a program that is the front end for a database (Access). One of the fields in the data base is set up to use options set in the field's 'Row Source' during design of the database. (When viewing the records in Access it comes up as a list box) I am wondering how I can get the options for that field into my program without hardcoding them. I can get the option that is currently chosen for a record back, but I need to know how to get ALL the possible options for that field. I'm using ADODB objects to access the database. Any help or pointers in the right direction will be much appreciated.
Quinn
|
|
|
|
|
If you are using the ADO object in your application, do a simple query:
Select [YourField] from [YourTable]
Once you have executed that SQL statement say when the form loads, you can add items with something like:
ListBox.Clear()
Do While Not adors.EOF
ListBox.Add(adors("[YourField]"))
Loop
HTH
Nick Parker
|
|
|
|
|
That didn't work. Stoopid IE made me lose my reply and I'm too tired to type it again. In short, that will only return the one option that a row has as a value. If one of the options were never selected it wouldn't show up in the list box. Thx though. Anything else you can suggest?
Quinn
|
|
|
|
|
Are you saying such as if someone were to hold down the shift key when clicking the mouse inside the listbox, thus selecting multiple items? Is your question on how to get the value of all those selected items?
Nick Parker
|
|
|
|
|
I think if you alter Nick's query so it starts out as SELECT DISTINCT .... it should give you the values you need.
James
Simplicity Rules!
|
|
|
|
|
Sorry James, but the SELECT DISTINCT change didn't help either.
Nick:
What I am needing is, in Access, when viewing a table it can be set up so that when you are entering data into the database directly that a list box will open for a particualr field and display the options that you can select for that field. Such as a 'Gender' Field. A list box will show the options 'No Answer', 'Male', 'Female' so you can choose one of those three options for the record. If in all the records for that table only 'No Answer' and 'Male' have been chosen, I need a way for my program to also recieve 'Female' to add to MY list box, so that it can be selected in my program.
I hope that helps clarify what I am looking to do using ADODB.
The actualy field I need to do this with isn't Gender, but it makes for an easy example, else I'd be hardcoding all the live long day.
Thx again for the tries.
Quinn
|
|
|
|
|
And maybe VB.Net in general.. why is it looking a bit un-represented?
No VB.Net tab on the front page here?
A lack of articles?
I've also noticed this from Microsoft itself in general?
I'm a long time Powerbuilder guru whose looking at .Net and it had seemed now that VB finally has some inheritance along with better data support I thought it might be worth a hard look. However C# and C++ seem to have the heavy amount of attention. I'd rather not pick the wrong one and then have to start again.. while starting again. Can I assume this will be supported or will Microsoft continue to make me change gears either by smoking out their competitors [regardless of merit] or starving off their own languages?
Craig Kazial
|
|
|
|
|
Craig,
The reason that you are seeing so much C#/VC++ on this site is that it's main contributors have heavy backgrounds in some C++ flavor. Due to the .NET Framework release, many of those same developers have decided to go against managed C++ in turn for C#. I work for a *strictly* VB shop right now and I assume that we will continue to go that route, however I myself am rather interested in C#. This site has been a great learning experience where I believe we can all benefit from each other. Take a look at our current competition where you can build a Code Project screen saver using the .NET Framework in any language, even VB.NET. Here is the link in a new window. The race to build the perfect Screen Saver. I hope this answer some of your questions.
Nick Parker
|
|
|
|
|
Part of the reason is due to the design of .NET
I read all of the C# articles, and post in the C# forums (and know the answers sometimes too) because most of them, and most of the "work" in getting to know .NET is to do with the framework classes, and not the syntax of the language. I just convert the code in my head to VB.NET syntax and most of the time it works.
I think VB.NET is a fantastic language, and I will keep using it, but I think that forums like this will not cover it much because, firstly, CP is a C++ oriented place, and secondly there is a stigma about "VB" that makes people think of bad programming, and indeed, in my experience, the language can attract bad programmers.
Choice of C# vs VB.NET is a lot to do with IDE, neatness of syntax, and almost nothing to do with capabilities. Choose the one you feel confortable with, but you might have to look at both to find samples/help etc.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
David Wengier wrote:
Choice of C# vs VB.NET is a lot to do with IDE
The IDE is the same for all languages in .NET.
David Wengier wrote:
and almost nothing to do with capabilities
In fact, VB.NET has some limitations, like only one namespace in each assembly (it's a property of the project), no boolean shortcircuit evaluation, and so on. Ok, you can workaround most of them.
I think that the language choice has more to do with the programming background you have: for me, every VB code I've written was a pain, and was because if I wrote in C++, I would have only a few programmers capable of mantaining my code.
With C# I feel that other programmers in the team can read, understand and mantain my code, even if they only coded in VB...
C# syntax is more elegant (in a C++ POV) than VB.
Crivo
Automated Credit Assessment
|
|
|
|
|
Daniel Turini wrote:
The IDE is the same for all languages in .NET.
The IDE is generally the same, but there are a few differences. The project properties are a bit different, plus other minor differences.
Daniel Turini wrote:
like only one namespace in each assembly (it's a property of the project)
VB supports namespaces the same as C#.
Namespace MyNamespace.MyNestedNamespace
Class A ' Full name: MyNamespace.MyNestedNamespace.A
End Class
End Namespace
Daniel Turini wrote:
no boolean shortcircuit evaluation
You don't get short circuit evaluation using And/Or, but if you use AndAlso/OrElse you get short circuit evaluation.
VB doesn't support:- indexers: a special property which allows you to access an instance of a class like an array, instead you get an Items property.
- operator overloading: Allowing a class to create new meanings for +, -, *, /, etc
- Optional parameters: Create and call methods without any value being provided. As you'll see below it is supported but with a twist.
- unsigned types: This isn't too important because unsigned types are not compliant with the CLR anyway, they are provided for conveinence.
VB does support:- Late binding: Calling methods on an object without having to know what type the object is, just that it supports that particular method signature.
- Optional parameters with default values: Just like C++ you don't have to provide values if you just want the default value. The default value is required, unlike VB6.
- Handles keyword: Events can be wired up at compile time without needing to use
myEvent += ..... , though if someone wants they can use the VB equivalent, AddHandler . Coming from using VB for all my real programming projects I naturally wanted to use VB.NET, but there were enough minor things that irked me into using C# instead.
First, I prefer curly braces over Then, End *, etc. Second, I really did not like the addition of the short circuit keywords, I would have rather had And/Or do it. Third, I prefer curly braces . Fourth, I did not care for using keywords like Shadows
Aside from those differences there isn't a whole lot of difference between C# and VB.NET, 90% of your code is going to be using the .NET base class libraries so that is where a lot of the knowledge is going to be.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Optional parameters: Create and call methods without any value being provided
But because of overloading, it can be done with two different methods, just leave out one parameter
James T. Johnson wrote:
Handles keyword: Events can be wired up at compile time without needing to use myEvent += ....., though if someone wants they can use the VB equivalent, AddHandler.
And how could anybody want to use anything else! In all of my C# code, whenever I accidently create an event handler I dont want, I think "oh damn" and delete the method. Then, come build time, bring on the errors, as the code, miles up in the file, hidden in the GUI created #region, mentions these missing methods.
(I seem to be just replying to you and ranting these days... you must have a friendly face )
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Programming background is absolutely one of the things that will sway a decision, and it also sways the arguments. I agree with most of what you have said, and James mentioned about the short-circuiting.
You did mention that the IDE is the same, and I have found this to be not true, and the areas that are different are annoying. I only find these annoying because of my background in VB though, and because of where I am used to finding things.
For example, the two drop-downs at the top of a code window in VB work as they did in VB6, and I find this very useful. Whenever I start up a C# project, I always fumble around for a little while trying to remember how to get it to insert the method signitures of any interfaces I am implementing.
There is also things like reformating of code (automatic indenting for example). I find that VB does this at every stage, whereas C# doesnt. I like it, but I can see it would be enough to annoy people.
Related to that, the error checking that is done in VB is realtime, so as you type. In C# it happens at build time.
Now these points, it is obvious that I come from, and like, VB. It is easy to see how these features would irk a C# or C++ programmer, but there are enough of them (i feel) to make it an issue when deciding.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Craig Kazial wrote:
why is it looking a bit un-represented?
#1 reason is that this is mainly a C++ development site, and many of the coders who are using .NET are doing so with managed C++ and C#.
In my reply to Daniel I list some of the differences between VB.NET and C# and my reasons for choosing C# over VB.NET.
In the end you have to make up your mind which language to follow, but I can almost guarantee that the MS VB MVPs will not let them drop VB anytime soon I would recommend learning a bit of C# for two reasons, to see which one you like, and so you can make use of 75% of the sample code out on the web.
James
Simplicity Rules!
|
|
|
|
|
How can I disable to control buttons(minimize, maximize/restore, close) on a MDI parent form?
|
|
|
|
|
In the object insepector you can set MaxButton / MinButton to True/False. If you set them both to false, they disappear - not disabiled.
Dylan Kenneally
London, UK
|
|
|
|
|
Object inspector? I am thinking you are refering to the property listings and that it does not have max/min properties to set, it has those on the child or normal forms but I do not have them for the mdi form. If you are refering to something else, please let me know, because I haven't heard of the object inspector before. thx again.
|
|
|
|
|