|
I have an MDI application. The forms have the following style.
form_load()...
ControlBox = False
MaximizeBox = False
MinimizeBox = False
FormBorderStyle = FormBorderStyle.None
WindowState = FormWindowState.Maximized
end sub
I have Form1 open, and if i open Form2 and close Form2, Form1 gets activated again, which is fine. But it gets resized to a smaller size and even th following code in form1_Activated doesnt resize it back to its original size.
private sub form1_Activated(....)
Me.WindowState = FormWindowState.Maximized
Me.Height = mszForm.Height
Me.Width = mszForm.Width
end sub
What is going on? thanks for any help.
vk
|
|
|
|
|
How to set the connection to an access db using VB.Net without specifying the drive name.
With Best Regards,
Mayur
|
|
|
|
|
|
Use an application configuration file with the path in???
Use Project->Add Component and choose Application Configuration File???
|
|
|
|
|
Hey philipcj, thnx for your help. Could you please elaborate on the steps that you have provided. Since I am a fresher in .NET, if you could provide some examples, it would be great.
With Best Regards,
Mayur
|
|
|
|
|
Hi
If you add the app config file using the Add Component to Project that I mentioned previously, you can type values in as follows:-
<configuration>
<appsettings>
<add key="AppTitle" value="My Product Name">
<add key="TempDir" value="c:\windows\temp">
<add key="DbDir" value="c:\data\db">
Then you can use the following lines of code to retrieve the data:-
dim sAppTitle as string
sAppTitle = System.Configuration.ConfigurationSettings.AppSettings("AppTitle")
Suggest you read help for a bit more information, thats about as much as I know. I do know this replaces .ini files that I used to use in VB6.
To answer your question more directly, it may be that you can include the access db as part of the project and not have to specify the drive, just the name. I don't know how to do this however. There are a number of ways of connecting as any book will tell you, but all of them need a path at some point. So your problem is purely about being able to access the current directory. Maybe one of the samples I have seen that comes with VB does this - not sure, sorry! If I find it, I'll post it here.
Regards
Phil
|
|
|
|
|
I am about to implement a vb.net database application and one of the main requirements is for the user to be able to add user-defined fields. It is an inventory control application where the user should be able to add their own fields to tables. For example a database table on cars would have standard fileds ID, Make Model, etc, but the user needs to have the ability to add their own fields to these records. Are there any other good approaches/patterns that you would recommend for this. Any good code examples out there for this type of problem?
Puzzle
|
|
|
|
|
I would create a set of separate tables and make a one-to-one join with the real tables. That way you don't alter the original tables. So the user tables have a primary key that matches their original counterpart and the user can add their columns to that table. This way, if they break anything, they don't break the original columns.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Make one table for the field information (name, et.c.), and one table for the data.
Example:
Fields<br />
-+ FieldId int<br />
-- UserId int<br />
-- FieldName varchar(30)<br />
<br />
FieldData<br />
-+ CarId int<br />
-+ FieldId int<br />
-- FieldData varchar(100)
---
b { font-weight: normal; }
|
|
|
|
|
As the title,
I would like to convert .DOC, .XLS, .PDF, .PPT(not important) to JPEG.
Any article or free API?
Thank you!
|
|
|
|
|
Hi
I have a problem in visual basic 6. I want to stop
a sequence of program (Loop) using a button clik (Externally)
thanx in advance
by
KK
|
|
|
|
|
You have to call DoEvents in the loop to handle the message queue, or the program won't respond to events.
---
b { font-weight: normal; }
|
|
|
|
|
If you state more specific questions you probably get more replies.
Anyway if you mean how to interrupt a loop from outside in VB6 this a way:
Declare a global variable like Alive as boolean
Your loop will be:
Alive=True
While Alive
(...)
DoEvents
End While
In your button event:
Alive=False
That's it.
|
|
|
|
|
Hi all
I want to show the data on Datagrid control and having group by faciltity
please give any hints idea to do it
|
|
|
|
|
Hello,
how can i find out the number of rows in a datagrid.
Thanx,
chitranjan
more dash than cash!!!
|
|
|
|
|
after binding the datagrid
use this
Dim i As Integer<br />
i = DataGridView1.DisplayedRowCount(True)<br />
MsgBox(i)
abhinav
|
|
|
|
|
here is datagridview1 the name of the datagrid?my datagrid does not have the property displayrowcount at all.
more dash than cash!!!
|
|
|
|
|
i m using vs.net 2005
i think u r using vs.net 2003
if u r filling the datagrid from database using dataset here is another way:
Dim i As Integer<br />
i = CInt(dst.Tables(0).Rows.Count)
abhinav
|
|
|
|
|
the method suggested by abhinish is the only way to do it in vs.net 2003.
With Best Regards,
Mayur
|
|
|
|
|
When we call some build-in function of VB.NET,
it will have a box to tell us what the method done,
what the result returns.
How can I make my own function have that description of function?
Besides, How to make a function parameter optionally?
Thank you!
|
|
|
|
|
Your first question has been asked lots of times just search this forum for it.
The second one is well documented in the official help but basically:
friend function X (optional byval s as integer = 1) as integer
|
|
|
|
|
how to execute a query in visual basic using a xml call..instead of using connection string.i also want to know the count of values from the executed query using xml
regards
shabari
|
|
|
|
|
Sir,i have created two dynamic controls and bind it to the grid .but the problem is i can't add these controls to the grid and after adding how could i get these controls in the next row of the grid and also i couldn't tke values from the control. hre i s code thsat ihve written.
Private Sub CreateTable()
If Session("DYNA") Is Nothing Then
dtTemp = New DataTable
dtTemp.Columns.Add("sct", GetType(Control))
dtTemp.Columns.Add("scr", GetType(Control))
Session("DYNA") = dtTemp
Else
dtTemp = CType(Session("DYNA"), DataTable)
End If
End Sub
Private Sub bindTable()
DataGrid2.DataSource = dtTemp
DataGrid2.DataBind()
End Sub
Private Sub FillGrid()
Dim sql As String
Dim DT1 As New DataTable
Dim obj As New clsValidation
sql = "SELECT Firstcol,Secondcol from Dynamic where code='1' "
DT1 = obj.ReturnDataTable(sql, strconnect, erpath)
Dim i As Integer
For i = 0 To DT1.Rows.Count
If Trim(DT1.Rows(0).Item(i)) = "TextBox" Then
createTextBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "CheckBox" Then
createchkbox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "ListBox" Then
createListBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "RadioButton" Then
createRadBox()
ElseIf Trim(DT1.Rows(0).Item(i)) = "DropDown" Then
createDropDown()
ElseIf Trim(DT1.Rows(0).Item(i)) = "LinkButton" Then
createLinkButton()
End If
Next
bindTable()
End Sub
Private Sub createTextBox()
Dim i As Integer = 0
Dim z As Object
Dim tb As New System.Web.UI.WebControls.TextBox
tb.Visible = True
tb.BorderStyle = BorderStyle.Double
tb.BackColor = y
tb.ID = "TextBoxID" + i.ToString()
i = i + 1
display(tb)
End Sub
Private Sub display(ByVal ctrl As Control)
Dim dr As DataRow
dr = dtTemp.NewRow
dr(0) = CType(ctrl, Control)
dtTemp.Rows.Add(dr)
End Sub
Private Sub DataGrid2_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid2.ItemCommand
If TypeOf e.CommandSource Is LinkButton Then
Dim lnkTemp As New LinkButton
Dim btn As Button
Dim txtTemp As LiteralControl
Dim ctrl As Control
lnkTemp = CType(e.CommandSource, LinkButton)
Select Case Trim(lnkTemp.Text)
Case Is = "Add"
Dim drs As DataRow
drs = dtTemp.NewRow
ctrl = CType(e.Item.Cells(2).Controls(0), Control)
drs(0) = ctrl
dtTemp.Rows.Add(drs)
bindTable()
End Select
End If
End Sub
Private Sub DataGrid2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid2.ItemDataBound
Dim i As Integer
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.Footer Then
If dtTemp.Rows.Count > 0 Then
For i = 0 To dtTemp.Rows.Count - 1
e.Item.Cells(i).Controls.Add(CType(dtTemp.Rows(i).Item(0), Control))
Next
End If
End If
End Sub
|
|
|
|
|
Hi Guys,
Can someone tell me how we can add tool tip text to a command button. This property was available in VB. When the cursor moves over a command button, some text would be displayed. Which is the property in VB.Net for a command buttonto set the same. Thnx.
With Best Regards,
Mayur
|
|
|
|
|
You can add a ToolTipProvider to your Form, then every control gets a property called ToolTipText or something.
HTH
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|