|
I'll leave the part about saving and retrieving the values up to you since there are so many methods of saving these values somewhere...
You can set the Size, Location and StartPosition properties of the form before you call the form's Show or ShowDialog method:
Dim newForm As New Form2
newForm.Size = New Size(100, 200)
newForm.StartPosition = FormStartPosition.Manual
newForm.Location = New Point(50, 50)
newForm.Show()
RageInTheMachine9532
|
|
|
|
|
Perfect. And by inserting the middle three lines into the Load event, and changing 'newForm' to 'Me', I've managed to change the main form as well. Don't worry about the saving - I've got that bit sorted out.
Thanks for your help.
|
|
|
|
|
Hi..I want to configure the data adapter to select all columns from a aspecific table in my database then fill the dataset with this data and do some functions on the data and then i want to display the results in a datagrid how can i do this and can i find any VB.NET code example to do it ?
Thanks
|
|
|
|
|
If you create the dataset using the Fill command of dataAdapter - for example
dtAdapt.Fill(myDataset,"TableName")
then you write:
myDataGrid.DataSource = myDataSet.Tables("TableName")
Manos Papaoikonomou
|
|
|
|
|
Thanks for your reply but I don't want to display all the data from the dataset I want to do some functions on some columns from the dataset and then display the results in the datagrid any idea ?
|
|
|
|
|
maybe you can create a DataTable in your DataSet containing the results
Dim workTable as DataTable = New DataTable("Results")
you fill the DataTable "Results" with the results of your functions maybe with a Do While Loop or a For Next loop from the original table and then you add the DataTable in the DataSet
myDataSet.Tables.Add("Results")
Finally you can bind your DataSet with the DataTable results
wrkGrid.DataSource = myDataSet.Tables("Results")
Manos Papaoikonomou
|
|
|
|
|
Hi everyone!
(sorry for posting twice, but I posted in the wrong "area"(NET Framework) earlier)
New member and also new to VB.NET I'm planning to learn it, in order to creat nice user interfaces to databases.
The problem:
I have som code for moving nodes between treviews, and everything work fine as long as there already is one node in the destination treeview (we're talking drag and drop here).
However, I want to be able to check if there is NO destination-node, and in those cases run alternativ code.
I can only make it happen if I use OnErrorResumeNext statement in the sub, but I understand that is not a good way to handle exceptions like this.
Public Sub TreeView_DragDrop(ByVal sender As Object, _<br />
ByVal e As DragEventArgs) _<br />
Handles TreeView2.DragDrop, TreeView1.DragDrop, TreeView3.DragDrop<br />
<br />
Dim NewNode As TreeNode<br />
If e.Data.GetDataPresent("System.Windows.Forms.TreeNode", False) Then<br />
Dim pt As Point<br />
Dim DestinationNode As TreeNode<br />
<br />
<br />
pt = CType(sender, TreeView).PointToClient(New Point(e.X, e.Y))<br />
DestinationNode = CType(sender, TreeView).GetNodeAt(pt)<br />
<br />
<br />
NewNode = CType(e.Data.GetData("System.Windows.Forms.TreeNode"), TreeNode)<br />
<br />
On Error Resume Next 'don't want to use it here<br />
If Len(DestinationNode.Text) < 1 Then 'error occur<br />
'If Err.Number <> 0 Then MsgBox(Err.Description)<br />
CType(sender, TreeView).Nodes.Add(NewNode.Clone)<br />
Else<br />
DestinationNode.Nodes.Add(NewNode.Clone)<br />
DestinationNode.Expand()<br />
End If<br />
'Remove original node<br />
NewNode.Remove()<br />
End If<br />
End Sub<br />
Thing is, if I don't drop the data on an existing node, "DestinationNode" has no value, but even if I try to check for Null-values an error occur, and the code stop running.
I want to be able to check for a valid value within DestinationNode, and make descision based on that, without causing an error. (IF there is no DestinationNode, THEN...)
How do a do this WITHOUT using On Error Resume Next?
Andreas
//Sweden
|
|
|
|
|
Look into Try/Catch blocks...
Try
[Some code that might fail goes here]
Catch [Grab exception type here]
[Code to handle exception goes here]
Catch [Grab a different exception type here]
[Code to handle a different exception goes here]
Finally
[Code that always runs no matter what happens goes here]
End Try
RageInTheMachine9532
|
|
|
|
|
You could also just check if DestinationNode is Nothing:
pt = CType(sender, TreeView).PointToClient(New Point(e.X, e.Y))
DestinationNode = CType(sender, TreeView).GetNodeAt(pt)
If DestinationNode Is Nothing Then
...
RageInTheMachine9532
|
|
|
|
|
The "IS NOTHING" worked great!
...and I learnd something about Null and Nothing!
Thanks Again!
|
|
|
|
|
I used a textbox control with the flexgrid to get data from user at runtime. I managed it programatically in Visual Basic 6.0. But I struck up in getting inputs from user by using flexgrid with in VB.NET.Can anyone help me out.
Thank You
with rgds,
prash
|
|
|
|
|
Is it possible to write C++ code directly into a form or module as a function or such?
|
|
|
|
|
I don't think so.
Maxwell Chen
|
|
|
|
|
No. It's has to be written into a seperate project and then you can reference it from your VB.NET app. The opposite is also true for C++. Mixing code languages can only be done at the project level. Your solution can have a project written in VB and another project written in C++. The two languages cannot appear in the same project.
RageInTheMachine9532
|
|
|
|
|
Thankyou, this seems to be the solution to my problem.
|
|
|
|
|
hey,
im wanting to make who wants to be milionaire type game, but i am only a beginner, does anyone have some suggestions, or previously made code for this type of thing that will help me in my process.
Thanku in advance.
|
|
|
|
|
Doesn't that game already exists in its PC Version?
Real Programmer isn't who just knows how to use a programming tool, Real Programmer is who knows how to write cool stuff in any language, 'cuz he/she/(it!!?) thinks like a machine .
|
|
|
|
|
I was working with a datagrid control connecting to a small 3 column access database. I have everything working but i have a save button and i want the save button to become active right when you edit something in on of the fields. I have accomplished this by using a timer and saying
if dataset.haschanges then<br />
btnsave.enable = true<br />
end if
But this only enables the button when you stop editing that cell i want the button to become active right when the editing begins. Thank you
|
|
|
|
|
Try this event!
dragrid1_edit
I don't remember exactly!
Do you want a loans with good services? Do you want to improve your finance?
This web site will be helpful
www.c-loans.com
You will love our services!
|
|
|
|
|
Am inserting a calender control programmatically into a web form but when I browse/ preview it & try to select, a date, the form gets 'reset' All controls apart from the buttons disappear It seems their is some hidden javascript that I can only see in the html, when browsing & not when developing.
What should I do to be able to submit selected dates to a database? (And not 'reset' the form)
|
|
|
|
|
This question belongs in the ASP.NET forum...
This sounds like a standard form that is never going to change. Why the need to insert a DateTime picker programatically? If the user is not supposed to see the control (or a group of controls), why not put it in a DIV or SPAN section, or a .NET Panel control, and keep it hidden until the user needs to see it?
RageInTheMachine9532
|
|
|
|
|
The entire form is being asembled programatically... client's wishes... The only controls that are 'declared' in asp.net are the containing asp panel and a hidden textbox. How do I insert a datetime picker programatically?
|
|
|
|
|
That's insane! Oh well, it's their money...
The way I've done it in the past is to put a PlaceHolder control on the page where you want the new controls to show up. This make it much easier to control the placement of generated controls. Next, when you put the new control in the PlaceHolder's Controls collection, you'll have to wire up the event handlers yourself. The basic code is something like this:
Dim myCalendar As New Calendar
myCalendar.ID = "myCalendar"
AddHandler [add any event handlers and function delegates here]
RageInTheMachine9532
|
|
|
|
|
Hi, I'm creating a COM Dll using VB6, I created simple functions to make an update on a database, but it doesn't work, I'm using an ASP Page that succesfully create the object but gives me errors when I try to insert or update data (Also I tried creating the object from other VB Application but didn't work either, 'weird' but when I use this code on a EXE it works, but I need this in a COM Dll).
VB Dll Code
Public Function Save()<br />
Dim Cn As New ADODB.Connection<br />
<br />
Cn.ConnectionTimeout = 100<br />
Cn.ConnectionString = "DBQ=test.mdb;" & _<br />
"DRIVER={Microsoft Access Driver (*.mdb)};" & _<br />
"DefaultDir=C:\My Docs\My Source Code\VB\ASP-COM Test;" & _<br />
"UID=admin; PWD=;"<br />
Cn.Mode = adModeReadWrite<br />
Cn.Open<br />
<br />
Cn.Execute "INSERT INTO tests (test_value) VALUES ('test3')"<br />
<br />
Cn.Close<br />
<br />
Save = True<br />
End Function
ASP page code
<%<br />
Dim iTest<br />
Set iTest = Server.CreateObject("TestProject.Test")<br />
<br />
Response.Write iTest.Save<br />
%>
Like this it returns this error
Error Type:<br />
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)<br />
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.<br />
/xue2/index.asp, line 6
I also tried using a RecordSet Object but gives this error:
Error Type:<br />
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)<br />
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.<br />
/xue2/index.asp, line 6
Thanks if anyone can help!
Vertigo
|
|
|
|
|
Hi
I faced similar problems with {Microsoft Access Driver (*.mdb)}; provider
try : OLEDB jet provider :
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin; Password=;"
and check http://www.connectionstrings.com [^]for more
|
|
|
|