|
I have 3 variables A,B,C. If the value of A is X then the values of B and C should be Null. If the value of B is X then the values of A and C should be Null and If the value of C is X then the values of A and B should be Null. Either the value of A,B or C can be X at a time.IF not it should give an error. How to implement a logic for this without an If statement? I need a simple logic for this. I dont want multiple IF statements like
if (A==x) then
{ B==0 && C==0 }
else if (B==x) then
{ A==0 && C==0}
else if (C==x) then
{ A==0 && B==0}
else
printf("error");
|
|
|
|
|
Condition = (((A == X) && (B == null) && (C == null)) ||
((A == null) && (B == X) && (C == null)) ||
((A == null) && (B == null) && (C == X)) );
a simple karnaugh table would have helped...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Azazazazaaaaa wrote:
the values of B and C should be Null
Please keep in mind that 0 and Null, Nothing in VB, are two entirely different things. Value types, such as Integer or Double, cannot be Null (Nothing), only 0. Null (Nothing) is used when a reference type doesn't point to an instance of that type or, in other words, points to nothing.
For example,
Dim myCustClass As New CustomerClass
myCustClass points to a created instance, or object, of CustomerClass.
In this example,
Dim myCustClass As CustomerClass
myCustClass doesn't point to an instance of CustomerClass. It points to Nothing since it didn't instantiate a new CustomerClass object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm making the tipic "about" form. This form is a child of a mdiForm.
How can I block the mdiForm when the user press the "about" button until the about form is closed? I suppose that there is a property to do this, but I can't find it.
|
|
|
|
|
you must make it modal...
use something like myForm.ShowModal() instead of myForm.Show() (i don't remember the right name)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
It's ShowDialog()
Thank you!!
|
|
|
|
|
I have run time generated data table and table style including numerictextboxColumns. I set datatable to datasource of Datagrid1. Before setting datagrids table style, user can move on cells with tab key , after setting table style, when user try to move on datagrid with TAB key, cursor jump 2 cells not one :S
What s problem.
|
|
|
|
|
Hello, I am a student of Microsoft Technologies.I want to build two device orienter utility in my project(in VB6).
0ne is -- automatic weight measurement tool
another is-- optical Barcode reader
can you please guide me from where I can get help about creating this type of control(in VB6/VB.NET).
-- modified at 5:26 Tuesday 6th September, 2005
|
|
|
|
|
OMG. Flashback.
I wrote something like that about ten years ago. Sorry. I don't have it in VB. I did it in Pascal, on a DOS machine, and I wrote my own communications protocol to handle it.
I assume that the scale and the barcode reader are separate devices, and that you will have items on a conveyer belt passing over the scale and being scanned. Timing will be a BIG issue. If you get a weight and a barcode together, everything is fine. But what if the scale fails to give a weight, or (more likely), the scanner fails to read the barcode. You will need to have some limit on how long you will wait for the barcode. Then the spead of the belt becomes vital. This should all be done asyncronously.
One problem we had was that if the conveyer was going too fast, it would twist the item as it went on the scale, and then the scanner did not read the barcode.
Sorry I can't give you any specifics. Good luck.
Roy.
|
|
|
|
|
I need scanning code in Visual Basic 6.0 by using Twain.Please anybody provide me some code for scanning and saving the file in TIFF format without showing the scanning setup dailog.
Srikanth V
|
|
|
|
|
G'day all, just a question about accessing a webpage from VB requiring two fields. I know how to downlaod a webpage, but not one that requires a password to access it. All I know is that this page requires two hidden fields and uses the "POST" method. Does anyone have any ideas on how I can implement this information to be able to download this page? Any assitance would be much appreciated.
Justin
|
|
|
|
|
i have to click a specific browse button and open a file in a textarea which is already there in my form. here i have to append to that file and save it. now the next time i open that file again the user must see the previous data and the date as well and then append to it. the functionality also demands that the user can also browse through a specific location and set and append that file accordingly.
please help me out as soon as possible.my mail id is kankan_paul@infosys.com
kankan paul
software engineer
infosys technologies limited
mob:9937341123
kankan paul
software engineer
infosys technologies limited
mob:9937341123
|
|
|
|
|
I'm not sure I got clearly your point here. What is really your question? How to open a file in append mode? How to append text to a text area? Is the file a pure text?
In the first case there are several ways of accomplishing it (using the old vb6 OPEN commands, through the .NET FW file streams), the official documentations provides lots of examples and almost ready to use code.
In the second case I suppose your text area is a text box. Then if you want to append the file content upfront:
yourtextbox.text=string.concat(ts.readtoend,today.tolongdatestring,yourtextbox.text)
where ts is the textstreamer of your file (a possible way of opening it).
Hope it helps.
|
|
|
|
|
since you cannot keeo the exact track that where user made changes so delete the previous file and create new with same name and extension and write the text from textbox. other wise to append the file this is the code.
Dim fl As IO.StreamWriter
Dim txt As IO.File
If txt.Exists("File.txt") = True Then
fl = txt.AppendText("File.txt")
fl.WriteLine("Write some thing")
fl.Close()
End If
|
|
|
|
|
You can also use the following code to append
Dim fw As New StreamWriter("File.txt", True)
fw.Writeline("something")
fw.Close()
This way, you don't have to worry if the file exists or not.
What this code does is initialize a new instance of the streamwriter class for the specified filename and if the file exists, it can be overwritten or appended. However, if the file does not exist, this will create a new file.
-- modified at 12:46 Friday 9th September, 2005
|
|
|
|
|
I want to import a VB 6.0 interface in my VC++ 6.0 program for my image thinning project. How to do so and how to link the interface objects with the coding? Can anybody provide me the source code or howto?
My VB form consists of a menu toolbar, command button,a picture box and a text box. I want to open a 50x50 TIFF image file using the menu item File->Open File and displays the image in the picture box. How to get the file name from the interface and load the image onto the interface?
Then I need to click the command button to convert the image to binary image(0 for white and 1 for black).(I have the coding for binary conversion but I don't know how to link them with the command button and accessing the image in the picture box.
Later, i need to display the binary image that I saved in a binary file in the text box in the interface. How to read and write a file through the interface? How to display the content of the file being read?
thank you very much
-- modified at 22:16 Monday 5th September, 2005
|
|
|
|
|
The way to do this is to write your C++ project using COM or managed C++ ( depending on what VB version you're using as much as anything ), and then call the C++ code from your VB UI. VB6 apps have been written like that for years - VB is good for hacking to gether a basic UI, and C++ is good at doing actual work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you for replying. It's a relief to know that VB 6.0 have the capabilities. Actually, I'm a newbie in this programming. Would you kindly guide me throught the whole process?
Currently, I'm coding my C++ program using VC++ 6.0 and my program consists of 2 files: main.cpp and lib.h. Can you please give me some easy examples or sample source code on how to call the C++ code(main.cpp and lib.h)from the VB 6.0 interface? Eg.the Hello World application?
BTW, what is COM or managed C++?;)
TQ
|
|
|
|
|
ladyscarlet99 wrote:
It's a relief to know that VB 6.0 have the capabilities.
OK, this is the first you specified VB6. That limits your options, but does not close them.
ladyscarlet99 wrote:
Currently, I'm coding my C++ program using VC++ 6.0 and my program consists of 2 files: main.cpp and lib.h.
OK, that sounds like a pretty basic console app, it doesn't even use standard headers. What's lib.h ? Why isn't there a main.h ? In any case, it's useless to you, although any code you wrote can be ported easy enough.
ladyscarlet99 wrote:
BTW, what is COM or managed C++?
VB6 is a dead language. As of 2002, Microsoft released VB.NET, which along with C# ( a new language at that time ) target a new runtime called the Common Language Runtime. If you had VS2002, 2003 or 2005, you could write C++ to target this runtime, and it would be really easy to call from VB.NET. This is called Managed C++.
COM is a lot more complex, but basically if you create an ATL project in VC++ ( I assume VC6 ? ), then you'll be creating a dll which can be called from VB6. COM is a huge subject, truthfully, I had three cracks at it before I got it enough to start using it. But in hindsight, it's not as complex as it seemed, but it is very different from a normal C++ app ( although, it IS a C++ app, and you can use any C++ you can use elsewhere, it's just working out how the framework sits together ). This[^] is the book that finally got it all together for me, I recommend it 100%. COM is just too hard to learn without a good book, all the more if you're more skilled in VB than c++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how can i Synchronise time using domainupdown control?time will change if domainupdown buttons are clicked.
Thanks for guidance.
|
|
|
|
|
What is a "domainupdown" control and what does it have to do with time?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, I couldn't work out what was going on here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah, that one made me go "domainupwhatdownwhowherewubbitcontrol"? It had me scratching my head so much, it made my bald spot bigger...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All:
I would like to share data between two Windows forms in this manner:
- Form 1 browses for the name of a text file, stores the name in a string variable (strTextFile), and calls Form 2 with the Form2.Show() command
- Form 2 has one button to display this text file in a text window called txtDocument.Text using My.Computer.FileSystem.ReadAllText(strTextFile), and two others to do Printer Setup and Print, respectively
My question is: how do I pass the name of the text file from Form 1 to Form 2? I am new to VB.NET, so please bear with me.
Thanks.
DERECK R. PRINCE
President
Roraima Technologies, Inc.
"Customizing Technology for ALL Your Business Needs!"
Saint Louis, Missouri, USA
Phone: 1-314-569-9035
|
|
|
|
|
roraima wrote:
My question is: how do I pass the name of the text file from Form 1 to Form 2? I am new to VB.NET, so please bear with me.
The most obvious way, if Form2 can do nothing without this string, is for Form2 to take a string in it's constructor, so you can't create a Form2 instance without passing this string in. Otherwise, you can make the string a property on Form2, and pass it in before calling Show().
Christian Graus - Microsoft MVP - C++
|
|
|
|