|
I recommend buying a beginner book on VB.NET and working through it. A breakpoint is what you set so the debugger stops on a line of code, to allow you to examine program flow.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here's what I'm trying to do:
- Write a VB.NET app which will set a specific service to automatically start if it's not already. I know that there's an article on codeproject.com on how to do this in C#, but either I cannot translate it, or there's something else going on.
(Here's the link to the codeproject.com article: http://www.codeproject.com/KB/system/extendservicecontroller.aspx#WMIArch[^]
Anyway, here's my code:
Dim path As String
Dim result As Integer
path = "\\" + Me.MachineName + "\root\cimv2:Win32_Service.Name=""" + Me.ServiceName + """"
Dim ManagementObj As New ManagementObject(path)
Dim Parameters(1) As Object
Parameters(0) = value.ToString()
Try
result = ManagementObj.InvokeMethod("ChangeStartMode", Parameters)
Catch ex As Exception
MessageBox.Show("Error Changing Start Mode", result.ToString(), MessageBoxButtons.OK)
End Try
...and it's not working. I don't know how to see the result code that ChangeStartMode is returning.
TIA for any help rendered.
-MC-
|
|
|
|
|
Hey Guys,
I found an article that helped me nest a datagridview within a datagridview; however, the nested datagridview doesn't scroll. I was wondering if someone could tell me what I'm missing. Here is my code, which works great when the datacolumn is frozen.
Dim dt As New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "SELECT distinct upc,sku,style,class_id,department,vendor FROM items a"
Dim adapter As New Odbc.OdbcDataAdapter(sql, New Odbc.OdbcConnection("DSN=tdprod;uid=ccotton;pwd=ccotton"))
If Not dt.Columns.Contains("upc") Then dt.Columns.Add("upc")
If Not dt.Columns.Contains("sku") Then dt.Columns.Add("sku")
If Not dt.Columns.Contains("style") Then dt.Columns.Add("style")
If Not dt.Columns.Contains("class_id") Then dt.Columns.Add("class_id")
If Not dt.Columns.Contains("department") Then dt.Columns.Add("department")
If Not dt.Columns.Contains("vendor") Then dt.Columns.Add("vendor")
adapter.Fill(dt)
DataGridView1.DataSource = dt
DataGridView1.Columns("upc").Frozen = True
DataGridView1.Columns("sku").Frozen = True
DataGridView1.Columns("style").Frozen = True
DataGridView1.ReadOnly = True
End Sub
Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.RowIndex >= 0 Then
If e.ColumnIndex >= 0 Then
If e.ColumnIndex = 2 Then
Dim list As New DataGridView
list.ReadOnly = True
Dim helpdt As New DataTable
helpdt.Columns.Add("Num")
For i As Integer = 0 To 8
Dim sub_row As DataRow = helpdt.NewRow
sub_row.Item("Num") = i + 1
helpdt.Rows.Add(sub_row)
Next
list.DataSource = helpdt
DataGridView1.Rows(e.RowIndex).Height = 100
DataGridView1.Columns(e.ColumnIndex).Width = 200
list.Width = 200
list.Height = 100
DataGridView1.Controls.Add(list)
Dim rect As Rectangle = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False)
list.Location = rect.Location
End If
End If
End If
End Sub
Any help would be greatly appreciated.
Thanks.
|
|
|
|
|
has anyone here used DB2Connect to call a DB2 stored procedure. I'm having trouble registering the input/output parameters.
|
|
|
|
|
Hi everyone...
I am working on a game project in VB.NET and flash 8, which requires data stored in an ORACLE database to be retrieved on the flash interface...
I tried to integrate ORACLE and flash, but it seems like an improbable outcome, so i tried sending data from flash to VB.NET and then from the front end to the back end. Apparently, I m stuck!
Can anyone help me find a way to integrate flash 8 to VB.NET or directly to the ORACLE database. Basically i need to retrieve the scores saved on the database to the .swf file
Thanks a lot
|
|
|
|
|
Your best source of information is going to be Adobe's support and/or community forums. What you're asking is very specific to the Flash Player.
But, AFAIK, you can't do what your asking about, though my experience with Flash is very limited.
|
|
|
|
|
Hello I have a little problem that has been really bugging me.
I have a program that I made that retrieves a database table from oracle. The program allows the user to insert and update the database. These functions work great. My problem is that I can not get the delete to work because the table doesn't have a primary key defined. I am not able to change the structure of the table by adding a primary key but I would like to add the primary key in my code.
what is the syntax to add a primary key in vb. My primary key will need to be a compound key that consists of the following three columns "GROUP_NAME", "ENTITY_TYPE", "DESCRIPTION.
I am lost this is what i tried but doesnt work:
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("GROUP_NAME")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("ENTITY_TYPE")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("DESCRIPTION")
any help would be greatly appreciated. I am a newbie
Erica
|
|
|
|
|
Never tried it, but I think you can just make an array of datacolumns to pass as the primarykey:
Dim pk3(2) As DataColumn
pk3(0) = MyDataTable.Columns("Col1")
pk3(1) = MyDataTable.Columns("Col2")
pk3(2) = MyDataTable.Columns("Col3")
MyDataTable.PrimaryKey = pk3
|
|
|
|
|
Thank you so much for that info.
Erica
|
|
|
|
|
imonfiredammit wrote: My problem is that I can not get the delete to work because the table doesn't have a primary key defined.
That's a huge mistake in designing the table schema. Nothing in your code is going to fix this. You can "patch" it by doing what your discussing, but the point behind the Primary Key is to have a field that uniquely identifies each and every record in the table. From what I've seen in your code, you cannot guarantee this. Your best course of action is to go back to the database and add a Primary Key column to the table.
|
|
|
|
|
(in WIN XP)I don't know the place in registry where I can get the exe
paths of all installed applications. However I can find the installed
applications in HLM\Software\Microsoft\Windows\Current Version\Uninstall.
I want to fetch the paths in a program from the registry.
Please help me...
|
|
|
|
|
You can't do this because that information isn't stored in the registry. The data is specific to each application, not the installer. The installer doesn't care what the path to the .EXE is, so it doesn't store that information anywhere.
|
|
|
|
|
Hello
how can i generate random numbers between 10.1 to 19.9, i mean for ex. 10.8,14.8,19.2 etc
any help
waiting for your kind help
thanks
|
|
|
|
|
<br />
dim rnd as new Random()<br />
dim val = 10.0f + (rnd.Next(99)+1.0f)/10.0f<br />
the .Next(99) method gives you a random number between 0 and 99
so (rnd.Next(99)+1.0f)/10.0f will give you a number between 0.1 and 9.9
|
|
|
|
|
hello sir
first of all thanks for your quick rep
and it's working fine
thank you very much for helping beginners like me
|
|
|
|
|
Do you want specific numbers with a step of 0.1 as in your example, or any floating point number between the values, i.e. numbers like 12.7848726343455 and 17.93847509823745?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello sir
thanks for your rep.
yes i want any numbers like 12.7848726343455 and 17.93847509823745 as you said but only two digits after decima like 12.78 , 17.93 something like that
waiting for your kind rep.
have a nice day
thanks
|
|
|
|
|
That doesn't make it much clearer, and it also doesn't match what you originally requested.
Perhaps you can explain what is it that you are going to use it for?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello sir
thanks again for your rep.
I just want to generate random numbers like 10.1,15.9,19.3,or 66.9,99.1 or 44.39,11.19,31.45 etc. like CKIng's help i have tried it and it's working but if you have some thing different then it's worth to know it
thanks again for your rep.
have a nice day
|
|
|
|
|
I am upgrading VB6 to VB.Net
here is the code giving me the error
<br />
Public Sub oCustomTask2_Trans_Sub1(ByVal oCustomTask2 As Object)<br />
<br />
Dim oTransformation As DTS.Transformation2<br />
<br />
oTransformation = oCustomTask2.Transformations.New("DTS.DataPumpTransformCopy")
Error 168 Constructor call is valid only as the first statement in an instance constructor.
whats the meaning of that and how can i resolve that?
here is the upgrade warning given by Upgrade vizard
'UPGRADE_WARNING: Couldn't resolve default property of object oCustomTask2.Transformations. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
|
|
|
|
|
Without knowing all the background it's hard to help but:
try
Dim oTransformation As New DTS.Transformation2
OR:
The problem is with the
<br />
oTransformation = oCustomTask2.Transformations.New("DTS.DataPumpTransformCopy")<br />
part.
A constructor is not a simple Method (it for example no return value) but a OPERATOR. So try
<br />
oTransformation = new oCustomTask2.Transformations("DTS.DataPumpTransformCopy")<br />
But as already said: it's hard to tell without knowing the oCustomTask (is it a class with subclass Transformations? Or is it a Namespace?) and DTS.Transformation2.
|
|
|
|
|
I can't get my sub main() to execute. I tried it in the main form and, as suggested by another user, in a module. The console.writeline never executes in either place. What am I doing wrong? Thanks!
Module Module1
Sub Main()
Console.WriteLine("HERE")
End Sub
End Module
|
|
|
|
|
You have to set the entry-point in your project-settings. Normaly this points to the main-form - but you can set it to the Sub Main.
|
|
|
|
|
Well it seems I can only do that if I make the project a console application instead of a windows application. Otherwise sub main is not a choice in the startup dropdown. But I'm not sure what the difference is, or if I really want to do that.
|
|
|
|
|
Ok - you are right - strange.
Try using C# instead
|
|
|
|