|
I found a game assistance program posted on the web that I would very much like to use. It is written in BASIC. Ya'll may get a good laugh out of this, but I tried copying it into a windows folder and then renaming the folder "Ironclads.exe". I get an error telling me it is not a valid win 32 application...The addy to the game assistance program: ftp://www.grognard.com/pub/games/board/ironclad.txt
Anybody got any ideas? I am running Win95 on this particular computer? You can contact me at hanksteph@houston.rr.com Regards, Hank Smith
|
|
|
|
|
hmssws wrote:
I tried copying it into a windows folder and then renaming the folder "Ironclads.exe". I get an error telling me it is not a valid win 32 application...
What??? Renaming a folder will never generate this error.
I took a look at what you got from the board. It's an old QBASIC program. Just renaming it to an .EXE will NOT work. You have to load the thing into QBASIC and run it from there. You can't compile the thing under VB6 or VB.NET unless you rewrite the code.
Since your running Windows 95, you shouldn't have a problem running QBASIC, just open a command prompt and type QBASIC. QBASIC no longer comes with Windows 2000 and above.
RageInTheMachine9532
|
|
|
|
|
i have 4 columns in my datagrid which at the moment are displaying "yes" or "no". My boss wants these existing columns to display checkboxes instead. Ive tried really hard to find a solution to this problem but so far nothing has worked Any help would be greatly appreciated - getting desparate now!!
Chrissy Callen
|
|
|
|
|
DataGridCheckBoxColumn class is there in the API. What is the problem for u in using it?
|
|
|
|
|
basically im very new to this i need code examples to help me figure it out. How exactly do i apply DataGridCheckBoxColumn to any particular column that already exists in my datagrid??
Chrissy Callen
|
|
|
|
|
Sorry it is DataGridBoolColumn class.
An example is available in MSDN. Just I m giving it below..
using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
public class MyForm : Form
{
private DataTable myTable;
private DataGrid myGrid = new DataGrid();
public MyForm() : base()
{
try
{
InitializeComponent();
myTable = new DataTable("NamesTable");
myTable.Columns.Add(new DataColumn("Name"));
DataColumn column = new DataColumn
("id", typeof(System.Int32));
myTable.Columns.Add(column);
myTable.Columns.Add(new
DataColumn("calculatedField", typeof(bool)));
DataSet namesDataSet = new DataSet();
namesDataSet.Tables.Add(myTable);
myGrid.SetDataBinding(namesDataSet, "NamesTable");
AddTableStyle();
AddData();
}
catch (System.Exception exc)
{
Console.WriteLine(exc.ToString());
}
}
private void grid_Enter(object sender, EventArgs e)
{
myGrid.CurrentCell = new DataGridCell(2,2);
}
private void AddTableStyle()
{
// Map a new TableStyle to the DataTable. Then
// add DataGridColumnStyle objects to the collection
// of column styles with appropriate mappings.
DataGridTableStyle dgt = new DataGridTableStyle();
dgt.MappingName = "NamesTable";
DataGridTextBoxColumn dgtbc = new DataGridTextBoxColumn();
dgtbc.MappingName = "Name";
dgtbc.HeaderText= "Name";
dgt.GridColumnStyles.Add(dgtbc);
dgtbc = new DataGridTextBoxColumn();
dgtbc.MappingName = "id";
dgtbc.HeaderText= "id";
dgt.GridColumnStyles.Add(dgtbc);
DataGridBoolColumn db =
new DataGridBoolColumn();
db.HeaderText= "less than 1000 = blue";
db.Width= 150;
db.MappingName = "calculatedField";
dgt.GridColumnStyles.Add(db);
myGrid.TableStyles.Add(dgt);
// This expression instructs the grid to change
// the color of the inherited DataGridBoolColumn
// according to the value of the id field. If it's
// less than 1000, the row is blue. Otherwise,
// the color is yellow.
db.Expression = "id < 1000";
}
private void AddData()
{
// Add data with varying numbers for the id field.
// If the number is over 1000, the cell will paint
// yellow. Otherwise, it will be blue.
DataRow dRow = myTable.NewRow();
dRow["Name"] = "name 1 ";
dRow["id"] = 999;
myTable.Rows.Add(dRow);
dRow = myTable.NewRow();
dRow["Name"] = "name 2";
dRow["id"] = 2300;
myTable.Rows.Add(dRow);
dRow = myTable.NewRow();
dRow["Name"] = "name 3";
dRow["id"] = 120;
myTable.Rows.Add(dRow);
dRow = myTable.NewRow();
dRow["Name"] = "name 4";
dRow["id"] = 4023;
myTable.Rows.Add(dRow);
dRow = myTable.NewRow();
dRow["Name"] = "name 5";
dRow["id"] = 2345;
myTable.Rows.Add(dRow);
myTable.AcceptChanges();
}
private void InitializeComponent()
{
this.Size = new Size(500, 500);
myGrid.Size = new Size(350, 250);
myGrid.TabStop = true;
myGrid.TabIndex = 1;
this.StartPosition = FormStartPosition.CenterScreen;
this.Controls.Add(myGrid);
}
[STAThread]
public static void Main()
{
MyForm myGridForm = new MyForm();
myGridForm.ShowDialog();
}
}
|
|
|
|
|
thanks but is there any chance of having this in vb.net code please??
Chrissy Callen
|
|
|
|
|
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel
Public Class MyForm
Inherits System.Windows.Forms.Form
Private components As System.ComponentModel.Container
Private myTable As DataTable
Private myGrid As DataGrid = New DataGrid
Public Shared Sub Main()
Application.Run(New MyForm)
End Sub
Public Sub New()
Try
InitializeComponent()
myTable = New DataTable("NamesTable")
myTable.Columns.Add(New DataColumn("Name"))
Dim column As DataColumn = New DataColumn _
("id", GetType(System.Int32))
myTable.Columns.Add(column)
myTable.Columns.Add(New DataColumn _
("calculatedField", GetType(Boolean)))
Dim namesDataSet As DataSet = New DataSet("myDataSet")
namesDataSet.Tables.Add(myTable)
myGrid.SetDataBinding(namesDataSet, "NamesTable")
AddData()
AddTableStyle()
Catch exc As System.Exception
Console.WriteLine(exc.ToString)
End Try
End Sub
Private Sub AddTableStyle()
' Map a new TableStyle to the DataTable. Then
' add DataGridColumnStyle objects to the collection
' of column styles with appropriate mappings.
Dim dgt As DataGridTableStyle = New DataGridTableStyle
dgt.MappingName = "NamesTable"
Dim dgtbc As DataGridTextBoxColumn = _
New DataGridTextBoxColumn
dgtbc.MappingName = "Name"
dgtbc.HeaderText = "Name"
dgt.GridColumnStyles.Add(dgtbc)
dgtbc = New DataGridTextBoxColumn
dgtbc.MappingName = "id"
dgtbc.HeaderText = "id"
dgt.GridColumnStyles.Add(dgtbc)
Dim db As DataGridBoolColumnInherit = _
New DataGridBoolColumnInherit
db.HeaderText = "less than 1000 = blue"
db.Width = 150
db.MappingName = "calculatedField"
dgt.GridColumnStyles.Add(db)
myGrid.TableStyles.Add(dgt)
' This expression instructs the grid to change
' the color of the inherited DataGridBoolColumn
' according to the value of the id field. If it's
' less than 1000, the row is blue. Otherwise,
' the color is yellow.
'db.Expression = "id < 1000"
End Sub
Private Sub AddData()
' Add data with varying numbers for the id field.
' If the number is over 1000, the cell will paint
' yellow. Otherwise, it will be blue.
Dim dRow As DataRow
dRow = myTable.NewRow()
dRow("Name") = "name 1"
dRow("id") = 999
myTable.Rows.Add(dRow)
dRow = myTable.NewRow()
dRow("Name") = "name 2"
dRow("id") = 2300
myTable.Rows.Add(dRow)
dRow = myTable.NewRow()
dRow("Name") = "name 3"
dRow("id") = 120
myTable.Rows.Add(dRow)
dRow = myTable.NewRow()
dRow("Name") = "name 4"
dRow("id") = 4023
myTable.Rows.Add(dRow)
dRow = myTable.NewRow()
dRow("Name") = "name 5"
dRow("id") = 2345
myTable.Rows.Add(dRow)
myTable.AcceptChanges()
End Sub
Private Sub InitializeComponent()
Me.Size = New Size(500, 500)
myGrid.Size = New Size(350, 250)
myGrid.TabStop = True
myGrid.TabIndex = 1
Me.StartPosition = FormStartPosition.CenterScreen
Me.Controls.Add(myGrid)
End Sub
End Class
|
|
|
|
|
that was quick im very impressed..thank you..will give that a go right now.
Chrissy Callen
|
|
|
|
|
Hi
I have the same problem if you find the answer please tell me
|
|
|
|
|
well at the moment i'm looking into creating a listview instead on the advice of one of my colleagues
Chrissy Callen
|
|
|
|
|
I have a 2 labels and a check box..
I want if I click on checkbox change a setting, and for that 2 labels too ,if I click on them that setting maust change...it means the code of check and labels are the same
so how can I write one code for them 3..
(i have recive a reply "please help me " ..good but not complete)
help me Please again
|
|
|
|
|
Yes. The reply you got before was complete! If there is something missing, it's because the requirements you gave us are not complete.
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click, Label2.Click
If CheckBox1.Checked = True Then
CheckBox1.Checked = False
Else
CheckBox1.Checked = True
End If
End Sub
Note: You don't need code for the CheckBox itself to change it's state. The CheckBox will automatically handle that itself.
UPDATE:
I see from you other post that your looking to put code in the CheckChanged event of the CheckBox. You didn't mention what you wanted to put in your event handler, so, adding to the code above...
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
MsgBox("Check Changed!")
End Sub
And, no, it's NOT a good idea for one function to handle both the Label Click's and the Check Changed events. Clicking on the Labels will generate a Click event, which will call the Click handler above. If you change the status of the CheckBox, it will generate a CheckChanged event and will call your Click handler AGAIN.
RageInTheMachine9532
|
|
|
|
|
Tanx
nice solution
i can't remember that what did i do that mades overflow error
|
|
|
|
|
check back to my other post, it is the solution to your problem. it handles the event for all 3 objects.
------------------------
Jordan.
III
|
|
|
|
|
|
let me know how it goes.
the sub procedure i wrote in reply to my 1st original post will do what you want. it handles the 3 objects' click event, chaning the state of chk box. then right the code in the chkbox's checkedchanged method
------------------------
Jordan.
III
|
|
|
|
|
Hi.
I recently installed VB .NET 2003. It seems a lot more complex then VB6, which it is :P.
I was wondering if you can get DriveList, DirList and FileList boxes.
Also, I need to know if you can somehow DISABLE the use of all the .NET framework languages when compiling, because my basic app doesn't use it, and I want it to work on all PCs.
I really need to know these two answers.
Thanks in advance,
Kane~
|
|
|
|
|
Kane~ wrote:
I was wondering if you can get DriveList, DirList and FileList boxes.
Those control are deprecated, but still available in a backward compatibility namespace call VB6, go figure. It's recommended that you do NOT use them because there is no guarantee that they will still exist in the next versions of VS and the Framework.
To get to the controls, click on the "My User Controls" tab. Then, righ- click in the toolbox and pick "Add/Remove Items...". Scroll down the list of .NET Framework Components and check DirListBox, DriveListBox, and FileListBox. Don't check the Array version of these! Then click OK. You can now use these components just like before in VB6.
Kane~ wrote:
Also, I need to know if you can somehow DISABLE the use of all the .NET framework languages when compiling, because my basic app doesn't use it, and I want it to work on all PCs.
If you're writing in C#, J#, VB.NET, C++ with Managed Extensions, you MUST use the Framework. There is no such thing as not using it in VB.NET, or any of the others. So, no you can't turn it off. Any app that you write in VB.NET will only run on machines that have the .NET Framework installed.
RageInTheMachine9532
|
|
|
|
|
I have written a program that disconnects a Demand-Dial connection every so often, based on a timer. This has worked before, but after REinstalling Windows 2003 Server, it will not retrieve a handle of the server from any remote computers. It is written in VB.NET and i dont know what happened to stop its functionality. No developing operating systems have been changed.
The main calls are:
-MprAdminIsServiceRunning - which comes back false if I specify the server name, or if I use the keyword "Nothing" and execute it on the server, it comes back true.
-MprAdminServerConnect - which has the same behaviour as above.
More Below:
Private Declare Function MprAdminIsServiceRunning Lib "mprapi.dll" (ByVal lpwsServerName As String) As Boolean
Private Declare Function MprAdminServerConnect Lib "mprapi.dll" (ByVal lpwsServerName As String, ByRef phMprServer As UIntPtr) As Long
Thankyou for any help on this.
MASOSi
|
|
|
|
|
Finally Found It!
In the declarations above, the keyword 'Unicode' was missing after 'Declare'.
e.g. Private Declare Unicode Function MprAdminIsServiceRunning...
This may come in handy for someone one day.
MASOSi
Its amazing what you try when you're desparate.
Its amazing what you try when you're desparate.
|
|
|
|
|
Guys, I have a question and I'm not sure this can be done in VB6.
I have a VB6 ActiveX DLL project which contains a module where I declare all the public constants I require.
The thing is, I need to access the public constants from another project (a VB6 Standard EXE) that referenced it.
I found that public constants in the module are only accessible from within the project and I cannot move the public constants into a class as it is not allowed.
I am thinking of changing them into public variables or static inside a class and set the variables on the initialization of the class. Is this a good thing to do or does anyone have a better idea?
Thanks for the help,
Edbert P.
Sydney, Australia.
|
|
|
|
|
If I read your description right, all your constants are declared in a .bas module, right?
If you need to use them in another project, why not just add the existing .bas file to your new project? If you have to, strip any code out to a seperate .bas file. The idea being that you keep a library of constants, structures, and .DLL declarations in one file, everything being public and not in a class, so you can use them anywhere.
I used to keep a .bas module file just for Novell Client constants and .DLL function declarations. Any apps that I wrote that depended on even a few of these constants and functions, and there were a bunch of them!, included the same Novell.bas module file.
RageInTheMachine9532
|
|
|
|
|
I was hoping that there's another way and that I have forgotten VB6's tricks of the trades among all these .NET mumbo jumbo.
Thanks for the information
Edbert P.
Sydney, Australia.
|
|
|
|
|
Constants are constants... It really doesn't matter.
You could also keep them in a class file, between a namespace definition and a class definition. This way, you could keep the constants in a namespace and they would still be usable without creating an object from the class.
It's just a matter of preference...
RageInTheMachine9532
|
|
|
|