|
I'm using VB 6.0, and it doesn't let me do Imports System.IO
What do I do now?
-----------------
http://www.zachcalvert.com
|
|
|
|
|
OK. Then throw out EVERYTHING about namespaces and System , System.IO , File.Exists ... EVERYTHING. VB.NET is a VERY different language from VB6 and none of this stuff applies to VB6.
Now, you'll have to use the FileSystemObject to see if the specified file exists. This will return either True or False , it doesn't throw any errors.
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists("C:\myTestFile.txt") Then
.
. ' The file exists...
.
Else
.
. ' The file doesn't exist...
.
End If
To open a text file for sequential write, you'll use the Open statement (docs here[^]):
Open "C:\myTestFile.txt" For Output As #1
Print #1, "This is line 1"
Print #1, "This is line 2..."
Print #1, "This is line 3..."
Close #1
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi VB Gurus,
I have a Command line application in Visual Basic(it is a simple VB program without any form having a 'Sub Main'). Can anybody tell me how to return an integer from this application to the calling program.
Thanks in advance,
Jobby
|
|
|
|
|
VB6 and below doesn't support returning an exit code to the calling process (a.k.a. setting the ERRORLEVEL). But, it can be done using the ExitProcess API. You can find the simple code and example here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I have code that populates a dropdownlist control from a dataset. The dataset has two fields; one I assign to 'text' and one to 'value'. This all works great. My pull down list functionality works as advertised. PROBLEM is when I open the page, I populate all the controls with the value from the record that the page is displaying...The ddl value is assigned to the control in the code which loads the contols (witnessed by stepping throught the code, but the value that gets displayed in the Dropdownlist is always the 0 index item (first one in the dataset) and not the value assigned to it in the code assignments of the data record. I have tried assigning the value from the data table to a variable and then 'findbyvalue = to that variable', but no luck. I have searched the high seas for references to the use of the ddl, which funny enough seems to be elusive. For such a valuable/oft used control,in VB GUI, I would hope to find something that addresses the full use of the control . I mean 4GuysFromRolla did a million part series on the datagrid, but not even a page on the ddl? can anyone help me ?
I am getting my dataset from the global asa and populating the ddl
If Not IsPostBack Then
dsCBO = Application.Get("dsPhysCBO")
Me.ddlPMD.DataSource = dsCBO
Me.ddlPMD.DataTextField = "PhysLast"
Me.ddlPMD.DataValueField = "PUID"
Me.ddlPMD.DataBind()
no problem!
I get a datareader to populate the fields on the form and assign the stored value to the ddl
Me.ddlPMD.SelectedItem.Value = reader("PriMD").ToString
At this point (stepping through the code) value="PriMD"
still no problem.
I try to place the index of the ddl to the value passed in using a variable populated with "PriMD" a string myKey2
Me.ddlPMD.Items.FindByValue(myKey2.ToString).Selected = True
When the page displays...the text displayed in the ddl is that for the first item in the ddl dataset, not the text corresponding to the value of myKey2
Where do I error???
JR
|
|
|
|
|
Try this:
Dim i As Long
Dim iList As ListItem
either
iList = ddlContacts.Items.FindByText("Dave")
or
ilist = ddlContacts.items.FindByValue(3)
i = ddlContacts.Items.IndexOf(iList)
ddlContacts.SelectedIndex = i
That'll work
"If i was king cigarettes would be free."
|
|
|
|
|
Thanks for the response.
When I used the ddl and added items to the collection in the properties page I had no problems which only added to the confusion in trying to bring a value out of the ds and display the corresponding row in the ddl. So that I understand....
When I was using the findbyvalue or findbytext...I was 'probably' finding...but not setting the selectedindex to the indexof the 'found' row ? And I will presume that a variable of string, or long, can be inserted as the object of findbytext, or findbyvalue ?
I will try it later this afternoon...and when it works, even though I am a non smoker, you would have my vote for KING!
|
|
|
|
|
hi
i have created a calendar application which shows each day that has an appointment on it, but im having trouble printing the days which are hidden behind a scroll bar.
The user is suppose to be able to print the number of days which they specify and some days may not be shown on the screen.
I can print the screen but not anything behind a scroll bar.
any ideas or suggestions would be very much appreciated
thank you
vinesh
|
|
|
|
|
I am attempting to adjust the contrast/brightness of a 256 color, paletted bitmap in a VB PictureBox using the Windows API in VB 6.0. My first attempt was to change the palette using something like:
tempDC = CreateCompatibleDC(0&)
call SelectObject(tempDC, Picture1.Picture.Handle)
PaletteSize = GetDIBColorTable(tempDC, 0, 256, pal)
' Do stuff with the palette
Call SetDIBColorTable(tempDC, 0, 256, pal)
DeleteDC tempDC
That's just a basic outline of my code, not exact. Anyway, it worked but what I noticed was that if the user tried to readjust the brightness/contrast to the way it was before, the image did not look the same. An extreme case is when the user adjusts the brightness to as bright as it will go, thus producing just a white box. Upon trying to re-adjust to the default brightness, instead of the image the picturebox just displays a black box. It looks like changing the palette saturates some of the pixels, thus losing that information.
What I really need to do is take a device-independent bitmap created in VC++, and then somehow get that into VB and draw it on the picturebox. I also need to be able to adjust image brightness/contrast, but not permanently alter the image pixels in case the user wants to "undo" what they did. I've tried any number of Windows API calls to accomplish this, but to no avail. Right now, I am just writing the bitmap to file in C++, and loading it in VB like so:
Dim MyPic as StdPicture
Set MyPic = LoadPicture("the_image.bmp")
Then, when I need to display the image, I pass it to another function which calls PaintPicture on my PictureBox control:
Picture1.PaintPicture(MyPic, 0, 0, Width, Height, etc...)
I know there has to be a better way. How can I go from a set of pixels in VC++ to a device-dependent bitmap in VB that is adjustable and can have any adjustments performed on its palette "undone"? If somebody could give me some direction, that would be great! Thanks a lot.
Jason
|
|
|
|
|
have a look here:
http://www.vbaccelerator.com/home/VB/Code/vbMedia/Image_Processing/index.asp
|
|
|
|
|
Does anyone know what following error means:
Additional information: Unable to find an entry point named OCIEnvCreate in DLL oci.dll.
|
|
|
|
|
check this thread on dotnet247 about that problem.
http://www.dotnet247.com/247reference/msgs/19/99192.aspx
|
|
|
|
|
This may seem like a simple question, but I haven't been able to find an answer to it yet.
I'm writing a code parsing app that uses reflection to get the various types given referenced assemblies. I've located the assembly where all the basic data types (String, Boolean, Byte, etc.) are defined except Integer, Long, and Short data types. I've inspected mscorlib.dll and system.dll and didn't find them.
Does anyone know where these "types" are defined?
|
|
|
|
|
They are in mscorlib as well. Short, Integer, and Long are Visual Basic keywords that represent the types System.Int16, System.Int32, and System.Int64, respectively.
You can verify this easliy:
Dim t as Type = GetType(Long)
Console.WriteLine(t.Name) 'Prints Int64
Dim assem as [Assembly] = [Assembly].GetAssembly(t)
Console.WriteLine(assem.FullName) 'Prints mscorlib, Version=... etc.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thanks for your reply
I do know about the equivalancy of the data types, but I was wondering if the keywords were defined anywhere that I could read. For instance, I am wanting the user to be able to select from a data type combobox, and I would like to populate from the system assemblies...I know I can add these manually, but I'm not sure that Short, Integer, and Long are the only ones I am missing...these are the only obvious ones.
Anyway...thanks
|
|
|
|
|
Microsoft.VisualBasic.VbTypeName("System.Int32") 'Integer<br />
Microsoft.VisualBasic.SystemTypeName("Long") 'System.Int64
Charlie
if(!curlies){ return; }
|
|
|
|
|
|
Working with another fella, I was finally able to get a working example of GetIfTable going in VB.NET. The only problem is that its only partially working.
I still cant retrieve the name of the network adapters.
If anyone has a working example of GetIfTable or GetIfEntry with VB.NET (not c# here folks) I would be extremely greatful!!!
|
|
|
|
|
I followed the steps to do the "Redistributing the .NET Framework Using
Visual Studio .NET Deployment"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/vsredistdeploy.asp
At the section: To customize the launch condition message
1. In Solution Explorer, select the deployment project.
2. On the View menu, click Editor, and then click Launch Conditions.
a) At first we could not see section #2 (above) that was why we tried going
to the Tools ---> Customize ---> View ---> Coomands ---> Select View --->
Then drag the Launch Conditions into View menu and drop it there
b) Now we can see it appearing in View menu list ... but it is dimmed (can not access)!
Does anyone know how to do this?
Many thanks
--
Anh
|
|
|
|
|
Ok...can anyone help me with this problem. I"m havinng troulbe to figure out how to use the data members and fill them both completely with zeros while initiallize them in the default constructor.
Here is what I have so for the my header (.h) file...
class ConnectFour
{
private:
//date members
int board[12][13];
int numChips[7];
public:
ConnectFour();
//default constructor
};
And here is what I have in my .cpp file....
ConnectFour::ConnectFour()
{
board[12][13] = 0;
numChips[7] = 0;
for(int i=0; i < 12; i++)
{
for(int j=0; j<13; j++)
{
board[i][j] = 0;
}
}
for(int i=0; i<7; i++)
{
numChips[i]= 0;
}
}
IS THIS RIGHT?....BELOW IS HOW IT IS SUPPOSED TO BE DONE ON THE DIRECTIONS FOR THIS PROGRAM!
THANKS GUYS ..YOU GUYS SAVE MY LIFE
Data Members:
1.)a 2-dimensional array to hold the board – To make it easier to check for wins you chould use a board that has 12 rows and 13 columns. Only rows 3 – 8 and columns 3 – 9 will actually hold the board (which has 6 rows and 7 columns). The remaining cells will always contain zeros.
2.)a single-dimensional array of 7 ints to hold the number of chips dropped into each column of the board.
Methods
1.)a default constructor to initialize both arrays – filling them both completely with zeros
|
|
|
|
|
You might want to post this question in the VC++ Forum instead. This Forum is reserved for Visual Basic and VB.NET...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to make an address book and am having trouble with certain steps.
Does anyone know where I could find a good example to add, delete,
find, edit, save, and undo changes to an access database? This is my first time creating a project with a database and am having trouble with the concept. An example would be once a user fills in all the text boxes with their info and clicks the save button, do I have to update and add rows to my dataset first and then update the database? That is the confusing part for me. Even just a small example would be great for me to get the overall concept and build on it from there.
Thanks
Beginner in ASP.Net and VB.Net
|
|
|
|
|
Try to download the sample book from kidwaresoftware[^]. This book has only 50% of its set but you can read it just for understanding. I like this book too because it explain clearly and very good. But you need to know how to use VB6. You could find many more free sample chapter from kidware[^] website.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi Im a bit new to VB and try to understand how to build a class structure to store some data. First I tried to do it with type definitions and collections but this did not work, giving compill errors about using local types in "public scope".
The question is how do I do int in a proper way?
Should the types data, entry, value and vector be defined as separat classes or can I build them as types? I need to in other places of the code work with them separatly. If I do them as separate classes is there a way of doing this in one sigle file, most of the would be realy simple simular to a type definition?
What is best to use, a collection or a vector, when I define the entry type/class should I delcare the Values as a vector of value and the do ReDim on this when adding more data or use a collectiond that has suport for all this built in?
What Im trying to do is something like
data
-dataName as string
-DataEntrys() as entry
entry
-entryName as string
-Values() as value
-Vectors() as vector
value
-valueName as string
-valueValue as integer
vector
-vectorName as string
-vectorNumbers() as integer
|
|
|
|
|