|
in vb.net when we create a new form the code lookes like
Public Class frmlogin
Inherits Inherits System.Windows.Forms.Form
but in vb.net 2005 it doesn't work can anyone tell how to do this .i have a clss that turn form to round shape and i want to inherits that form instend of windows.forms.form
never stop from trying
|
|
|
|
|
This is definitely Monday.
I have an Excel worksheet that I am trying to get the contents of a DataGrid into.
worksheet.Cells(2, 1) = StatusGrid.Column(1).Item(1)
It would be nice if it were that simple. I was thiking of casting the datagrid into a table, but for reasons that are too cosmic to go into here, that is not possible at this time.
So... the question is.. Using VB.Net (ASP), how in the world does one reference a Cell in a datagrid?
|
|
|
|
|
Close...
StatusGrid.Items(1).Cells(1).Text()
|
|
|
|
|
So far so good. That works on bound columns beautifully.
Some of the other columns are rendered as Template columns. How would you perform the same operation on a column as defined here:
<asp:templatecolumn headertext="Date Added">
<itemtemplate>
<asp:label id="lblDateAdded" runat="server" text="<%# DataBinder.EvalContainer, "DataItem.DateAdded") %>">
<edititemtemplate>
<asp:textbox id="txtDateAdded" runat="server" text="<%# DataBinder.Eval(Container, "DataItem.DateAdded") %>" width="100%">
Thanks again in advance for all of your help.
-Ray
|
|
|
|
|
Depends on whats in em..
If you have textbox's etc in them, you'll want to look at the controls collection of the cell, or use the FindControl method to just grab it.
|
|
|
|
|
That seems to be the problem:
//-- This works well: (just a bound column)
For i = 0 To StatusGrid.Items.Count - 1
worksheet.Cells(i + 2, 1) = StatusGrid.Items(i).Cells(1).Text()
Next
//-- but when I use: (Tries to get a Template Column)
For i = 0 To StatusGrid.Items.Count - 1
worksheet.Cells(i + 2, 2) = StatusGrid.Items(i).FindControl("lblDateAdded").ToString()
Next
...the appropriate cell text reads:
"System.Web.UI.WebControls.Label"
It doesn't seem to be finding the lblDateAdded control using the above method. Do I need to be casting it?
-- modified at 18:55 Monday 3rd October, 2005
|
|
|
|
|
I wonder if someone could help me.
Example....
I have 2 forms in a project. If I select say a button to hide Form1 and show Form2. There is a button on Form2 when selected will Close Form2 but show Form1.
What I have done is as follows....
Private Sub Form1Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.ActiveForm.Hide()
Dim myNewForm As New Form2
'Display the calculation form
myNewForm.ShowDialog()
Form1.ActiveForm.Show()
End Sub
Private Sub Form2Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form2.ActiveForm.Close()
End Sub
Form1 does not show and I get the following message....
An unhandled exception of type 'System.NullReferenceException' occurred in Testing.exe
Additional information: Object reference not set to an instance of an object.
Any ideas where I am going wrong.
Thanks in advance
|
|
|
|
|
Worked it out I think
Private Sub Form1Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim about As New Form2
Me.Hide()
about.ShowDialog()
Me.Show()
End Sub
|
|
|
|
|
I have a combobox(vb .net windows form application) in which I am trying to offer the user 5 selections, then based on those selections, if one is chosen I would like to offer two more selections, and so. This is similar to say having to chose a country then a state, then a city, etc. My problem is I have bound a dataview to the combobox to offer the initial 5 selections, but I cannot figure out how to proceed to offer the remaining 'nested' selections.
Not sure at all how to 'popup' the other selections after the 1st choice is made in the combobox.
Any suggestions are appreciated
-- modified at 11:06 Monday 3rd October, 2005
|
|
|
|
|
You can use the SelectedIndexChange event of combobox such that when a combobox changes its selection you update the other (nested) combobox... and so on.
e.g, if user selects a country.......update the states combo with particular state values.......and so on for the cities.......
Is there anything difficult....
_mubashir
|
|
|
|
|
Hi
I need to plot data stream coming from the serial port on a VB6 chart.
I found alot of example using mschart.ocx. But now I am using vb6, mschart.ocx is upgraded to mschrt20.ocx, so I can not run the demo program.
what should I do?
Thanks
|
|
|
|
|
I must be missing something simple....
I have a procedure that handles menu popup events,
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click, MenuItem2.Click
how do I tell from inside the procedure which one was clicked?
or even better, If I build my menu at runtime, how could I define this procedure to handle (and know which one) any menu click event? I do not know how many items until run time so I can not define them all in the procedure header.
Thanks in advance
sincerly,
Lost in context menu heck....
|
|
|
|
|
Well.. you could use diffrent procedures to handle diffrent menu items
PS:
-----------------------------------------------------------------------
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
'MenuItem1 Code Goes Here
End Sub
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'MenuItem2 Code Goes Here
End Sub
-----------------------------------------------------------------------
Hope that helps
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
That will not help much if I do not know the menu items at compile time.... or am I missing something?
|
|
|
|
|
I have attempted to upgrade a VB6 system to .Net that I have inherited and have to maintain and I have come across the following code that I really don't understand.
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As frm_back
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As frm_back
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New frm_back()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
this is referenced from :-
frm_back.DefInstance.CrdVersion3 = New MultiChip.Schuler
frm_back.DefInstance.JCM = New JCM.clsJCM
can someone please explain what is going on as this program just goes away after the call to frm_back.DefInstance.JCM = New JCM.clsJCM
Regards,
Alf Stockton
|
|
|
|
|
These segments are inserted by the Upgrade Wizard to continue offering a default instance of the form. You may not need it - the wizard inserts it into every form.
e.g.,
in VB6 you could have:
myForm.Show()
without explicitly instantiating the form.
If you find that "DefInstance" is not being used anywhere, then it means the original code was not following that poor VB6 practice of using default form instances.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant C++: C# to C++ Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
|
|
|
|
|
Hi there
Being a Newbiee I need some help. Think I've done well so far but now I'm stuck.
The word template in question uses a macro that takes the users input in a custom dialog and propagates it throughout the document. The entries I store in the registry and they are displayed in the dialog the next time it is used. The problem is that I have realized that it is not that registry content I want to display as default in the dialog. Instead I want the actual document values. These values are stored in word bookmarks.
How can I read these bookmarks content and display them in the fields of the dialog as default? Should I store them in fields in the document instead?
This code brings up the registry entries in the fields of the dialog:
Private Sub UserForm_Initialize()<br />
<br />
Dim Docprop As String<br />
<br />
Docprop = "HKEY_CURRENT_USER\Software\Microsoft" _<br />
& "\Office\"<br />
<br />
With FrmDocProp<br />
<br />
.TxtProject.Text = System.PrivateProfileString(FileName:="", _<br />
Section:=Docprop, Key:="Project")<br />
<br />
.TxtClient.Text = System.PrivateProfileString(FileName:="", _<br />
Section:=Docprop, Key:="Client")<br />
<br />
.TxtDocType.Text = System.PrivateProfileString(FileName:="", _<br />
Section:=Docprop, Key:="DocType")<br />
<br />
.TxtPreferredDate.Text = System.PrivateProfileString(FileName:="", _<br />
Section:=Docprop, Key:="Preffdate")<br />
<br />
.TxtAuthor.Text = System.PrivateProfileString(FileName:="", _<br />
Section:=Docprop, Key:="Author")<br />
End With<br />
<br />
End Sub
This is how the bookmarks in the document gets populated with the entries of the dialog fields
Private Sub CmdOK_Click()<br />
<br />
Dim vProject As String<br />
Dim vClient As String<br />
Dim vDocType As String<br />
Dim vPreferredDate As String<br />
Dim vAuthor As String<br />
<br />
vProject = FrmDocProp.TxtProject.Text<br />
vClient = FrmDocProp.TxtClient.Text<br />
vDocType = FrmDocProp.TxtDocType.Text<br />
vPreferredDate = FrmDocProp.TxtPreferredDate.Text<br />
vAuthor = FrmDocProp.TxtAuthor.Text<br />
<br />
'declare ranges<br />
Dim bkProjectRange As Range<br />
Dim bkclientrange As Range<br />
Dim bkDocTypeRange As Range<br />
Dim bkPreferredDateRange As Range<br />
Dim bkAuthorRange As Range<br />
<br />
'set the rangesequal to the current bookmarks<br />
Set bkclientrange = ActiveDocument.Bookmarks("ClientName").Range<br />
Set bkProjectRange = ActiveDocument.Bookmarks("Project").Range<br />
Set bkDocTypeRange = ActiveDocument.Bookmarks("DocumentType").Range<br />
Set bkPreferredDateRange = ActiveDocument.Bookmarks("Prefdate").Range<br />
Set bkAuthorRange = ActiveDocument.Bookmarks("Author").Range<br />
<br />
'pass in the info now contained in the variable (what the user typed)<br />
bkProjectRange.Text = vProject<br />
bkclientrange.Text = vClient<br />
bkDocTypeRange.Text = vDocType<br />
bkPreferredDateRange.Text = vPreferredDate<br />
bkAuthorRange.Text = vAuthor<br />
<br />
'wrap the same bookmark around this text<br />
ActiveDocument.Bookmarks.Add "ClientName", bkclientrange<br />
ActiveDocument.Bookmarks.Add "Project", bkProjectRange<br />
ActiveDocument.Bookmarks.Add "DocumentType", bkDocTypeRange<br />
ActiveDocument.Bookmarks.Add "Prefdate", bkPreferredDateRange<br />
ActiveDocument.Bookmarks.Add "Author", bkAuthorRange<br />
<br />
End Sub<br />
Thank you for any help!
WOW Ruules!!
|
|
|
|
|
Hello to all.
My problem is this,
i have to control if a service is up/down on my pc.
for example ssl connection.
I made my program(service) to see if the service (ssl connection) is up/down and if is down, start the ssl connection.
You can see the code here...
Imports System.ServiceProcess
Imports System.IO ' Utilizacao de escrita/leitura de ficheiros
Public Class KeepingServiceAlive
Inherits System.ServiceProcess.ServiceBase
' Definir o serviço a controlar
' Para experiência vamos utilizar o SSL de HTTP
Dim ServicoControlo As New ServiceController("SSL de HTTP")
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
End Sub
'UserService overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' The main entry point for the process
<mtathread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New KeepingServiceAlive}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
Friend WithEvents tmrWatchService As System.Timers.Timer
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.tmrWatchService = New System.Timers.Timer
CType(Me.tmrWatchService, System.ComponentModel.ISupportInitialize).BeginInit()
'
'tmrWatchService
'
Me.tmrWatchService.Enabled = True
Me.tmrWatchService.Interval = 5000
'
'KeepingServiceAlive
'
Me.ServiceName = "KeepingServiceAlive"
CType(Me.tmrWatchService, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
#End Region
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
End Sub
Private Sub tmrWatchService_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrWatchService.Elapsed
Dim ficheiro As TextWriter
' ServicoControlo.Refresh()
If ServicoControlo.Status = ServiceControllerStatus.Running Then
ficheiro = New StreamWriter("C:\sacor.txt", True)
ficheiro.WriteLine("Service is running... ")
ficheiro.Close()
Else
Try
ficheiro = New StreamWriter("C:\sacor.txt", True)
ServicoControlo.Start()
ficheiro.WriteLine("Service started")
ServicoControlo.Refresh()
ficheiro.Close()
Catch ex As Exception
ficheiro = New StreamWriter("C:\sacor.txt", True)
ficheiro.WriteLine("Can't start ssl connetion service")
ficheiro.Close()
End Try
End If
End Sub
End Class
The problem is that sometimes work and others don't
thanks for your time
|
|
|
|
|
I am making a wild guess here....
There are 2 possibilites with your service,
1. It's started
2. It's stopped
In the first case it might be possible that the service hasnt completly stopped yet so it cant start itself since its still running.
In the Second Case if u start the service it surely will since currently its stopped.
Hopefully it helps
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
Why don't you just configure the service recovery options? When you double-click on the SSL service in the services management console, there is a tab called "recovery". You can configure the service to restart on failure. Sounds like you have a problem though if SSL is failing so often that you need to keep restarting.
|
|
|
|
|
Hi,
I am getting "InvalidOperation" exception when using the June- Enterprise library blocks for Data access in VB.NET 2005. The same code works fine in 1.1 framework. Though I copied the dataconfiguration config file to Debug folder, its still showing error at DatabaseFactory.CreateDatabase()line. Please help.
regards,
Jasmin
|
|
|
|
|
I would like to determine whether the current user is Authenticated against the network domain or not. I am using VB6 SP5. Can anyone help ??
|
|
|
|
|
Hello All,
I am working on a collge project with VB.NET and trying to make something similar to Remote Desktop available in Windows XP.
I tried using Windows Media Encoder SDK to capture the screen activities as video(not good quality) but its a CPU hogger and the processing goes upto 95% making it virutally impossible to do any other active process on the remote machine.
Is there a soln that can help me capture and broadcast live to the client at the other end?
Also i installed DirectX 9.0c SDK to play video files using the DirectAudioVideo class and the problem is that i need to capture key and mouse events on the video window.
I used a list box to render the output of the video file, suprisingly when i play the video in full screen mode it captures the mouse and key events but if its not a full screen mode all the events are ignored, why is that happenning?
Thanks for reading.
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
Google for "VNC" and you'll find what you're looking for.
Forget using the Media Encoder for this. It's too slow, a CPU hog (as you've found), generates low quality, and is not designed for this application.
telophase wrote:
I used a list box to render the output of the video file
LISTBOX? Why?
Anyway, search for VNC and you'll find that you've been doing this the hard way.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes i know what a VNC is and what it can be used for but i dont want to use a ready made software.
I am doing the above mentioned as project in my college and i need to submit code there
So i need to "write" my own version of VNC in any programming language possible.
Any further help appreciated
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|