|
I didn't know listbox.Text was reflecting the selection; a little experiment shows it only works well for SelectionMode "One", otherwise it only shows one item out of many.
|
|
|
|
|
Luc Pattyn wrote: I didn't know listbox.Text was reflecting the selection; a little experiment shows it only works well for SelectionMode "One", otherwise it only shows one item out of many.
Not really useful knowledge, but VB6 has some 'features' to save the programmer from having to type much. One can't put multiple items into a string, so it does make sense in a VB6-kinda way.
This should raise an exception, from the point of view of a .NET programmer;
Dim A$: A$ = label1 In VB6 it will just copy the value of the 'default property' of the label into A$, conveniently the caption. One can't learn the language without also learning to curse and swear
Merry Christmas
|
|
|
|
|
Welcome...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Thanks in Advance
I made a setup in Visual Studio 2008 Setup Wizard of a Database Application (Language VB) having Crystal Report as a reporting Tool
In the Previous setups the Reports were previewing perfectly but now when i Build the Setup its is giving Error on Test as well as on Client PC assembly error of "CrystalDecisions.Windows.Forms" that cannot be found while it is added in the Dependencies/Setup and was working ok before
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I Added Prerequisites and Problem solved is their any other solution because Prereq. sizzze is 240 Mb
Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Hi Experts,
Am beginner on vb .net programming and would like to get some solutions here. I tried to search around google but i cant really find articles which similar to my case.
Here my scenario is,
Am dealing with windows mobile and I got multiple screen, multiple scenario that share same key in text field which i had create on another form.
Because of the limited space available on screen, then i decided to create a new form for user to key in the data then save it behind the main application on invisible textbox but i found tat i need to duplicate multiple *same form to deal with my scenario. So I would like to know is there any better way to do so?
Explain in more details by example:
I got screen A, B, C ,D and a data form.
User will open either screen A, B, C or D then upon of screen that they choose, they need to open data form to key in extra data and save in behind the main application (screen A, B, C, or D).
What can be done for the moment is i create 4 same data form each for screen A, B, C and D. Then, I would like to know whether its possible to be just 1 data form and how can i do it?
Thanks.
Regards,
George
|
|
|
|
|
What about creating a object/class to hold your data, but make the properties, variables etc. SHARED.
This would allow every form that the uses that object, to share data.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Seems that this is the only way to deal with it by input another module and declare the object as global object?
Am looking for an alternative way, secure one, is this possible?
Rookie here.
|
|
|
|
|
New to Visual Basic 2008
This warning is showing up (turns to a compile error if I have Option Strict set to ON) in various lines of code and I'm unsure how to fix it.
a couple of line examples are
If GetData(driPhoneBD, chkShowAll.CheckState.ToString) = True Then
The GetData function accepts the second parameter and is Boolean - chkshowall.CheckState is -1 if it's ticked and 0 if it's not
I could set GetData second param to a numberic, but I'd rather find out how to "convert" the -1 and 0 values of CheckState to boolean because I will have to do it at other points during programming.
Another example is this
.IncDate = dgviPhoneBD.CurrentRow.Cells(6).Value.ToString
.IncDate is a date variable in my class and dgviPhoneBD is my datagridview
I read that I could use this
.IncDate = Date.Parse(dgviPhoneBD.CurrentRow.Cells(6).Value.ToString)
and whilst the warning does disappear, I'd like to know if this is the correct way to convert a value to the correct datatype.
Why, for example, is there not this
.IncDate = Date.Parse(dgviPhoneBD.CurrentRow.Cells(6).Value.ToDate)
Why is it always "ToString()"?
Thx for your help
|
|
|
|
|
wmar67 wrote: (turns to a compile error if I have Option Strict set to ON)
Please... Do yourself a favor, and ALWAYS have Option Strict set to ON. It should NEVER be turned off, if you want your code to be stable. I think many people will echo my sentiment that the "Option Strict" shouldn't even be an option, but rather permanently on.
As for the actual conversion... I believe it's the same in VB.NET as it is in C#.
Convert.ToBoolean(x)<br />
Convert.ToDouble(x)<br />
Convert.ToDate(x)
etc...
The conversion isn't done by the variable itself, but by the System.Convert class.
|
|
|
|
|
I second Option Strict On for all new development (and as much old code as possible)
If chkShowAll.CheckState is an integer and you need a boolean, why not do a comparison:
If GetData(driPhoneBD, (chkShowAll.CheckState <> 0)) Then
For your second example, I would suggest setting a breakpoint and determining the actual type of the .Value . If the value is actually storing an Date object, you could just say CDate(......Value) and never do a ToString . There are many similar functions for the basic types, CInt, CLong, etc and for all others you can use CType(value, TargetType) .
|
|
|
|
|
Thx for the answers.
Trust me when I say I will have Option Strict on. It was off by default and didn't realise until I started looking into this issue with Implicit Conversion.
|
|
|
|
|
Hi all.
i want to write some content into a text file in my application. am getting the input text like this:
AGREEMENT, SIGNIFY YOUR DECISION BY CLICKING THE "DO NOT AGREE" BUTTON; AND YOU MAY RETURN THIS PRODUCT (including all materials) TO THE PLACE WHERE YOU OBTAINED IT WITH YOUR RECEIPT WITHIN THIRTY DAYS FOR A FULL REFUND.
ATTACHMATE®
1. LICENSE. Attachmate Corporation ("Attachmate") grants you the right to use the Attachmate software programs contained in this package (the "SOFTWARE") on a single personal computer. The SOFTWARE consists of several programs and is licensed as a single product. The SOFTWARE'S component parts may not be separated for use on more than one computer or by more than one user at any time. You may install the SOFTWARE on a network server,
----------------------
i am trying to write this content into a txt file. i tried using put,write,writeline and print almost all the functionalities which i have come across in net.
But to my surprise, i am getting the output as follows:
IMPORTANT: PLEASE READ THE FOLLOWING LICENSE AGREEMENT CAREFULLY BEFORE CONTINUING BECAUSE THE SOFTWARE PRODUCT IS LICENSED, NOT SOLD. IF YOU PROCEED WITH THE SETUP PROCEDURE (installation) OR USE THE SOFTWARE (OR AUTHORIZE ANY OTHER
PERSON TO DO SO) BY CLICKING THE "AGREE" BUTTON, THEN YOU ACCEPT THE TERMS AND CONDITIONS OF THE LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE TERMS OF THE LICENSE AGREEMENT, SIGNIFY YOUR DECISION BY CLICKING THE "DO NOT AGREE" BUTTON; AND YOU MAY RETU
RN THIS PRODUCT (including all materials) TO THE PLACE WHERE YOU OBTAINED IT WITH YOUR RECEIPT WITHIN THIRTY DAYS FOR A FULL REFUND. ....etc.,
the problem is, it is not writing exactly what is there in the input.. why it is happening like this?
can any one please enlighten me?
thanks,
rakesh.
|
|
|
|
|
It's impossible to say without seeing your code that writes the file.
|
|
|
|
|
Probably because you are not adding in new lines where you want the breaks to be.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
It's not possible to give you a better suggestion unless you post the code snippets...Do you try this by using <b>stringbuilder</b>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
This didn't happen in vs2005 I don't think, but vs2008 throws exceptions in debug on errors within my try-catch blocks. Can I turn that off? Thanks
|
|
|
|
|
That depends on which half of the Try/Catch the error occurs in. VS won't stop on an exception thrown inside a Try block. It WILL stop on an exception thrown in the Catch or Finally blocks.
|
|
|
|
|
Not so... my errors are being thrown within the try section. FI:
Try
Console.WriteLine(TTDG.Rows(1000).Cells(100).Value)
Catch ex As Exception
End Try
|
|
|
|
|
If you have no code in your catch block then you will "eat"/ignore any error that occurs within the try. Been this way since at least 2003.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
All I can tell you is that it is definitely happening for me. No code in the catch, but the error is trapped in the try.
|
|
|
|
|
ok but how many statements are you executing within the try. as soon as an exception occurs, you get kicked out of the try
statements 4 and 5 below will not be executed if an exception occurs at statement 3
try
exec 1
exec 2
exec 3 -> exception happens here
exec 4
exec 5
catch
end try
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
What is the problem for me is that the exception within the try is thrown. The debugger stops and shows me the error. I thought that exceptions within the try would be ignored. Thanks
|
|
|
|
|
for anyone to answer this in any detail you should show the actual code (inside PRE tags!) AND the exact exception information. And you should have done this from the start, 3 hours ago.
|
|
|
|
|
OK, here's one simple example
Sub test()
Dim x
Try
Console.WriteLine(x(0))
Catch ex As Exception
End Try
end sub
Error thrown is: Object variable or With block variable not set.
|
|
|
|