|
how do you create a control array in vb.net?
|
|
|
|
|
You can't create them like you did in vb6. The controls all have to have unique names, but you can have multiple controls use the same event code.
Let's say you have three text boxes.
TextBox1
TextBox2
TextBox3
You can set it up for all of them to use the same event code like:
Private Sub TextBox_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged, _
TextBox2.TextChanged, _
TextBox3.TextChanged
'do some common processing here
End Sub
|
|
|
|
|
Dim alist As New ArrayList
Here we have to create the object of the control and then u add the contol to the array
if u have any doubt see this link http://www.devx.com/vb2themax/article/19907
alist.Add(aControl)
|
|
|
|
|
i want to programatically call WindowActivate event of word object..
how can i?
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
hi guys...good day..can anyone help me how wiew map image in a picturebox and the same way i can trace or digitize there..with the function of zooming and panning...any help is highly appreciated....thanks
|
|
|
|
|
Hi,
I am newbie to VB.NET, though I have enough experience in VB6. I have a requirement where I need to develop a feature which will help users for print preview setup in a different way. We develop certain form designs through Page Maker. Then we have thousands of records in text files which are printed on these forms. However we need to do lot of manual adjustments to fit this text blocks in these forms.
Then come one idea to use Print Preview feature in VB.NET. I have never used this feature. I want to load these forms as JPEG image in background in Print Preview dialog and then load the text as usual. This will save manual effort to fit the text.
Does anyone have an idea how this can be done using Print Preview?
Cheers!!
Unmesh
|
|
|
|
|
Hi,
i want to show a datagrid inside another datagrid.How can i do that.
that is, in a column of first datagrid i want to put a second datagrid.
like we show buttons in a datgrid.....similarly i want to show another datagrid.
Thanks
|
|
|
|
|
make relationship in dataset(in Two table) and fill datasource.
i thing it is very usefuly for you.
Pavan Pareta
|
|
|
|
|
Please give the details of your requirement in detail
|
|
|
|
|
Can any one help me to do the same as i mention in my question. I want same functionality in my gridview like treeview in vb.net. if answer is Yes, then how can i do this?
TC
|
|
|
|
|
If I understand what you want, no, it can't. The DataGridView does not offer an kind of TreeView support.
You might want to try a better explaination of what you're looking for so we can possibly suggest something that might work for you.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hai VB'ers...
I have 2 problem :
1. How to send varibles from VB to Software NERO Burning Room? (variables like : the speed of burn, source file that we wanna burn, etc)
2. How to launch/call software (like: nero) from VB with VB codes?
Thxs b4...
Best Regrads,
Harry
|
|
|
|
|
harry_tan wrote: 1. How to send varibles from VB to Software NERO Burning Room? (variables like : the speed of burn, source file that we wanna burn, etc)
I stand under correction, but I doubt that this possible unless Ahead software have supplied COM/.NET visible libraries that expose methods developers may make use of, OR if you went through a HUGE mission of reverse engineering the bits that you need (which is more likely than not illegal).
What is it that you would like to do? There may be an alternative means.
harry_tan wrote: 2. How to launch/call software (like: nero) from VB with VB codes?
That one's easy -
System.Diagnostics.Process.Start("nero.exe")
|
|
|
|
|
Thxs's Kulazfuk...
I wanna make a program that can make a back up to CD media.
The flow of the logic of my program that i want is like this (I have 2 alternative logic) :
1.The program that i have been made send variables to Software CD Burning, after that the program launch/call that software with configuration that i have send it before.So, the user only to choose/click button "Burn" in that software and the process of burn it's begin.
2.The program that i have been made send variables to Software CD Burning, after that the program launch/call that software with configuration that i have send it before (this software CD Burning run like a background process) and automically execute the process of burn (so, the user don't need to choose/click button "Burn" in that software to begin the process of burn).
Do you have a conclusion/idea from the logic that i have been wrote?
Or do you have another logic that more logically, safe and legal?
I have tried the code that you have been told abot execute software from VB (System.diagnostics.process.start ("nero.exe")) but it can not work. It is error.
The VB showed :
Run-Time Error '424'
Object Required
I use VB 6.0
Why that error could show?And how to make that error can not show again?
Thxs b4...
Best Regrads,
Harry...
-- modified at 23:41 Thursday 26th October, 2006
|
|
|
|
|
You really can't control another application to do this. What you need is a library that offers CD burning support. I've never used any so I can't make any recommendations. Just Google for "CD Burning library" and you'll come up with plenty of them.
The code errored out because it was VB.NET code. It won't work in VB6.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thx's a lot for your comments Dave Kreskowiak and Kulazfuk...
If some one out there can help me about to launch/call another software from VB 6.0 codes?
Thxs b4...
Best Regrads,
Harry
|
|
|
|
|
Hi Harry,
Dave Kreskowiak is right, in VB6 that line of code will not work. I don't use VB6 so I can't suggest an alternative.
Sorry.
|
|
|
|
|
Ic...ic...
Thxs a lot for responses about my problems.
If someone out there can help me about how to call/launch another software with VB 6.0 codes?
Thxs b4...
Best Regrads,
Harry
|
|
|
|
|
I am trying to use Win32 API in Visual Basic 6.0 to get the text from a third party program that is using an Edit Control
Window within a #32770 DialogBox. But I am unable to find any SendMessage method to grab the content of the Edit window.
A DialogBox Class window acts as parent to a #32770 child. The #32770 child has an Edit child of its own. The entire dialog
is not a standard msgbox; instead, the dialog displays a list of financial data, with a horizontal scroll bar and no Windows
method to highlight and copy to clipboard.
I have the handles easily available to the dialog parent, #32770 child, and Edit child.
How do I use a Win32 API call (like SendMessage) to get the multi-line data found in this 32770-Edit dialog box?
The standard, methods for grabbing text, like wm_gettext, em_getline, etc. isn't working for me on the parent/#32770/edit
dialog.
Thanks for any direction.
|
|
|
|
|
artofsuntzu wrote: The standard, methods for grabbing text, like wm_gettext, em_getline, etc. isn't working for me on the parent/#32770/edit
WM_GETTEXT was about the only way you could get the contents of the control. It's not always possible to get the text from another application. Calling the API function GetWindowText sends a WM_GETTEXT message to the target window. If WM_GETTEXT fails, there's just about nothing you can do about it, short of implementing an OCR solution.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I need you help with a crystal report problem. The report is very simple, and I have already done the layout. Howerver, I need to deploy. I am using crystal reports version 10.
I have found some information on the internet about using ODBC using the DNS. And using the code below to write the connection. However, I tried wroking the code but didn't work for me. Here is it anyway.
code (put in a separate module called modCrystal.vb - to keep things tidy): -
<br />
Option Explicit On<br />
Option Strict On<br />
<br />
Imports System<br />
Imports CrystalDecisions.CrystalReports.Engine<br />
<br />
Public Function LoadCrystalRPT(ByVal strReport As String) As ReportDocument<br />
Dim cryDoc As New ReportDocument<br />
<br />
With cryDoc<br />
.Load(strReport)<br />
.SetDatabaseLogon(USER_ID, PASSWORD)<br />
<br />
' This will override the table locations<br />
Dim cryTables As Tables = .Database.Tables<br />
Dim cryTable As Table = Nothing<br />
<br />
Dim cInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo<br />
Dim lInfo As CrystalDecisions.Shared.TableLogOnInfo = New CrystalDecisions.Shared.TableLogOnInfo<br />
<br />
With cInfo<br />
.ServerName = ODBC_DSN_NAME<br />
.DatabaseName = DATABASE_NAME<br />
.UserID = USER_ID<br />
.Password = PASSWORD<br />
End With<br />
<br />
For Each cryTable In cryTables<br />
With cryTable<br />
lInfo = .LogOnInfo<br />
lInfo.ConnectionInfo = cInfo<br />
.ApplyLogOnInfo(lInfo)<br />
<br />
.Location = DATABASE & ".dbo." & cryTable.Location<br />
End With<br />
Next<br />
<br />
Return cryDoc<br />
End With<br />
End Function<br />
to use: -
cryReport.ReportSource = LoadCrystalRPT("C:\path\to\report.rpt")
where cryReport is the crystal reports viewer component.
==============
this code is for Crystal Reports v11, it may work with v10
but i can't guarantee it
==========================
I am not sure if the above method is the best, and the above is complicated for me to understand. Do you have any examples in using dataset or other methods? What is the industry method of doing this?
Thanks in advance,
Steve
|
|
|
|
|
What are you using as a datasource to populate the dataset? SQL Server? Is there any particular reason that you're using ODBC?
I have a sample on binding a crystal report to a dataset at runtime but I'm not sure if that's what you're after.
|
|
|
|
|
Hello,
Thanks for your reply. The reaaon I was using ODBC using the DNS to connect to a sql server 2005, as I thought it would be easy for the deployement.
However, if you have a sample that can be deployed, then I would be happy to use it.
Thanks,
Steve
|
|
|
|
|
I think you'll find that using SQL will be much easier on deployment, maintenance and performance. Also, AFAIK Microsoft have stopped support for ODBC.
Damned but it looks like I've deleted that sample I'm sure I had it on this machine but it's gone AWOL. Sorry. However I'm still determined to help you (if that helps any), so I'll summarize what it contained. It'll need modification to suit your needs but the basic idea is still there. This is the method I've used for countless Crystal Reports and it works every time.
Here goes -
• Create a connection to the database.
• Create data adapter objects (aka TableAdapters in .NET 2.0) to perform commands against the database (Select, Insert, Delete, Update, etc)
• Create a dataset to represent your data.
• Create the Crystal Report that is to bind to the dataset using the "Report Expert" wizard.
• When you want to run the report, call the fill method of the data adapter passing the dataset as an argument to the method. e.g.
Try
conn.Open() 'previously created connection
dsDataSet.Clear()
daAdapter.Fill(dsDataSet) '<- code for .NET 1.1
'daAdapter.Fill(dsDataSet.DataTable) '<- code for .NET 2.0
Catch ex as exception
Messagebox.Show(ex.Message)
Finally
conn.Close()
End Try
• Declare an instance of the report you created using the Report Expert outside of any subs (this way you can re-use it easily) e.g.
Private rptDataReport As rptReport
• When you want to view the report, create the new instance & set its SetDataSource property to the dataset e.g.
Private Sub LoadReport()
rptDataReport = New rptReport '<- new instance
rptDataReport.SetDataSource(dsDataSet)
End Sub
• Finally, load the report into the report viewer
CrystalReportViewer.ReportSource = rptDataReport
Hope that helps. If you get stuck, let me know.
|
|
|
|
|
Hello,
Thanks for all your responses. I have gone with typed dataset. However, I have a problem displaying the data in the report. I have created an typed dataset.xsd called DS_JobSheet.xsd. I have previewed the data and it displays everything. I have created the reports.
In the report I have select database expert | project Data | ADO.Net Dataset. I have select my dataset and selected the table.
I have dragged the fields on to the report. I think everything seems to be ok here.
The code for filling the report is below. I have added a grid to the report to see if that gets filled and it does. I just don't understand why my report does not show any data.
I have imported
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
Can any correct if I have done something wrong.
Many thanks,
Steve
<br />
Private Sub frmJobSheet1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim customerReport As New rptJobSheet1()<br />
Dim DS_JobSheet As DataSet 'DS_JobSheet is the .xsd data schema, data has been generated <br />
Dim IDNumber As Integer<br />
Dim cnn As New SqlConnection()<br />
Dim da As New SqlDataAdapter()<br />
Dim cmd As New SqlCommand()<br />
<br />
cnn.ConnectionString = "server=steve02\ssd02; database=serviceMaster; pwd=a123; user id=sa"<br />
<br />
cmd.CommandType = CommandType.Text<br />
cmd.CommandText = "SELECT * FROM Incident"<br />
DS_JobSheet = New DataSet<br />
<br />
Try<br />
cnn.Open()<br />
cmd.Connection = cnn<br />
<br />
da.SelectCommand = cmd<br />
da.Fill(DS_JobSheet)<br />
<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
<br />
IDNumber = 68 'Display record for ID number 68 this number exists in the database table<br />
<br />
customerReport.SetDataSource(DS_JobSheet)<br />
<br />
<br />
Me.CrystalReportViewer1.Refresh()<br />
Me.CrystalReportViewer1.SelectionFormula = "{Incident.IncidentID} = " & IDNumber & " "<br />
Me.CrystalReportViewer1.ReportSource = customerReport 'Application.StartupPath & "\JobSheetReport\rptJobSheet1.rpt"<br />
<br />
<br />
Me.UltraGrid1.DataSource = DS_JobSheet.Tables(0).DefaultView 'Data is displayed in the datagrid so this is ok<br />
Me.UltraGrid1.Refresh()<br />
<br />
Me.CrystalReportViewer1.Show()<br />
<br />
End Sub<br />
-- modified at 12:38 Thursday 26th October, 2006
|
|
|
|