|
|
Well a nice class is definitely a start in the right direction. But if you want to use threading, you need to learn enough about it to actually do so - and a good way to start is to write your own class, rather than look for one.
As far as the NET documentation, let me make an analogy.
Suppose I had a 9mm and an ingrown toenail, and suppose further that the only understanding of either I had came from a NET Walkthrough. Now, armed with this impossibly limited knowledge and some of my own basic cognitive ability, I might just put 2 and 2 together and decide that sitting down at my kitchen table and blowing away my big toe was actually a pretty reasonable way to combine my limited knowledge of a problem and a tool to achieve a "solution".
Now, assuming a I got very lucky, and all that was missing was my big toe, I would immediately realize that the MSDN never explained about how much a 9mm recoils, and that I was damn lucky I did not accidentally fire a second shot that either blew my head off, or worse still, blew my goober off. And it would only be upon further investigation that I learned that after taking off a big toe, a 9mm round would also penetrate the nearest wall leaving an entry hole about the size of a quarter and come out on the other side leaving a hole I could easily stick my head in. etc, etc, etc.
The moral of the story is you'll need a lot more than just an article. You'll need to look at a lot of example code, and more importantly experiment on your own a lot.
Cancelling a thread is a perfect example. The Threading class provides an Abort method, and sure, that will work - but only if you are doing something equally useless like a typical walkthrough that calculates prime integers.
If a real-life thread is not using something like db resources, file system resources, printer resources, etc. then you probably should not be using a thread in the first place. So any real app needs to terminate threads in a controlled manner. Usually a primary thread sets a flag that tells a worker to cancel a task. Only you can write the appropriate code because only you know what your thread is supposed to do, when the appropriate times are this it should check it's cancel flag, and how it should clean up after itself.
Threading is a journey, not an article...
|
|
|
|
|
Dear All Engineer,
Anybody can tell me how to create a registry during the Setup deploying time? I want the User can select which database folder they want to keep.
The example is create a windows registry folder as "HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName" with
Name = "Database Folder"
Type = "REG_SZ"
Data = "C:\CompanyName\Database"
|
|
|
|
|
|
Dear ToddHileHoffer,
Thanks a lot.
|
|
|
|
|
Hi folks,
With VBCommenter i commented my source code from a project, that works fine.
But i don't get intellisense info from the classes etc in the same project that i am working on.
The same problem occurs with other projects in the same solution that referenced this project.
When i reference the dll instead of the project, intellisense works fine.
But then you get other problems (ambiguous classes, etc).
Does anybody have an idea?
Thanks...
|
|
|
|
|
Hello all,
I have ddlA that loads another ddlB on a postback. I AM Able to get ddlA to load in the page load event;however, i can not get the ddlB to load from the selected value from ddlA.
Can someone please help me with this.
* I am very much open to all solutions for this issue. IF YOU have a better way or an easier way of doing this, by all means, please share it with me!
Erik.
Code===============================================
'
'GO NOW!
'
Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Customers()
End If
End Sub
'
Private Sub Customers()
ddlCustomers.DataSource = GetData()
ddlCustomers.DataTextField = "CompanyName"
ddlCustomers.DataValueField = "CompanyName"
ddlCustomers.DataBind()
End Sub
'
Private Sub LoadList()
ddlCompanyName.Items.Clear()
ddlCompanyName.DataSource = GetData(ddlCustomers.SelectedValue).CompanyName 'ado.net query
ddlCompanyName.DataBind()
End Sub
'''''
'...Northwind
''''
Function GetData()
'
Dim cnn As New SqlConnection("data source= desktop; initial catalog= northwind; trusted_Connection=yes")
'
Dim cmd As New SqlCommand("SELECT * FROM Customers", cnn)
cmd.CommandType = CommandType.Text
'
cnn.Open()
Dim result As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Return result
cnn.Close()
result.Close()
End Function
'
End Class 'STOOOOOOOOP!...
===============================================Drop Downs.................
| | <asp:dropdownlist id="ddlCompanyName" runat="server" autopostback="True"> | | Company Name | | Customers | <asp:dropdownlist id="ddlCustomers" runat="server" autopostback="True"> |
|
|
|
|
|
I don't see any code that attempts to load the second list - could you point it out for me please ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
That is where i am getting stuck. I thought that this is where the second ddl should load.
Private Sub LoadList()
ddlCompanyName.Items.Clear()
ddlCompanyName.DataSource = GetData(ddlCustomers.SelectedValue).CompanyName <---HERE...
ddlCompanyName.DataBind()
End Sub
I am still working on and off with this tring to get it to work, or get some information that can explaing how to implement something like this. IF You know of a good url please send it my way. i need to find the answer to this one before to long...
Erik...
|
|
|
|
|
Erik Lirttle wrote:
ddlCompanyName.DataSource = GetData(ddlCustomers.SelectedValue).CompanyName
I'm not sure what the .CompanyName property is supposed to do here, but a getdata function that takes the selected value and filters on it is the right idea.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I want to make a program which doesn't allow any how to go focus out of him not even the mouse cursor goes out the window and I even want to trap the message ctrl+alt+del,so that my process can't be killed.
|
|
|
|
|
There are more ways to stop a process than just pressing Ctrl+Alt+Del. Perhaps if you tell us why you want this functionality there may be a way to do something just as well but with a different solution. I know I'd feel pretty irritated if I used a program that forced the focus to it and didn't allow me to stop it running - the only reasons I can think of that you'd want to do this are not good reasons.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
While this may be a good idea for a kiosk application, it's just plain idiotic to do it in any other circumstance.
Also, you can't trap Ctrl-Alt-Del, unless, that is, you want to write a new GINA.DLL...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to hide my executing process in task manager.How can I?
|
|
|
|
|
|
You can't!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You just hide your appications in task manager's application list not in process list. you just have to do
form_load
app.TaskVisible=False
end sub
|
|
|
|
|
That only works in VB6 and only if the application doesn't show an interface.
If you read the documentation:
The TaskVisible property can only be set to False in applications that do not display an interface, such as ActiveX components that do not contain or display Form objects. While the application displays an interface, the TaskVisible property is automatically set to True.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to know how toexecute the program in v.b. before the login screen appears, and how to abort the system shutdown , I uses the abortsystemshutdown function but it works only in win98 and even in win 98 after calling the function the system shows the message not responding.
|
|
|
|
|
Anonymous wrote:
I want to know how toexecute the program in v.b. before the login screen appears,
This is a Windows Service application.
Anonymous wrote:
and how to abort the system shutdown
Why on earth would you want to do this? It's a VERY bad idea considering the only way you'd be able to shut down the system is to power off the machine. This, of course, runs the risk of corrupting Windows, the pagefile, the file system, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have been working on this problem for the last couple of days and have not been able to come up with a solution. This is probably due to my lack of experience building composite controls.
I am trying to fill the objMonthEvents array inside the CtlCal_DayRender handler then use that array in the CreateChildControls sub procedure.
The idea is to build a second control that would detail information gathered in the CtlCal_DayRender sub.
Thanks for any help in how I am trying to accomplish this or correcting the code detailed so it will work!
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Drawing.Color
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.OleDb
Imports System.Collections
Namespace nsTest1
Public Class clsTest1
Inherits Control
Implements INamingContainer
Dim objMonthEvents = New ArrayList()
Protected Overrides Sub CreateChildControls()
Dim CtlCal As New Calendar()
CtlCal.ID = "Calendar1"
CtlCal.SelectionMode = CalendarSelectionMode.Day
CtlCal.Font.Size = FontUnit.Point(8)
CtlCal.DayHeaderStyle.Font.Bold = True
CtlCal.OtherMonthDayStyle.ForeColor = System.Drawing.Color.Gray
CtlCal.DayNameFormat = DayNameFormat.FirstLetter
CtlCal.SelectorStyle.BackColor = System.Drawing.Color.FromArgb(&H99CCFF)
CtlCal.BorderStyle = BorderStyle.None
CtlCal.CellSpacing = 2
CtlCal.TitleStyle.BackColor = System.Drawing.Color.FromArgb(&H2F8DBE)
CtlCal.TitleStyle.ForeColor = System.Drawing.Color.White
CtlCal.TitleStyle.Font.Bold = True
CtlCal.SelectedDayStyle.BackColor = System.Drawing.Color.FromArgb(&HFCFAD7)
CtlCal.SelectedDayStyle.ForeColor = System.Drawing.Color.Black
CtlCal.SelectedDayStyle.Font.Bold = True
CtlCal.NextMonthText = ""
CtlCal.PrevMonthText = ""
AddHandler CtlCal.DayRender, AddressOf CtlCal_DayRender
Me.Controls.Add(CtlCal)
Dim i As Integer
For i = 0 to objMonthEvents.Count - 1
HttpContext.Current.Response.Write(objMonthEvents(i)) '-- process array value
Next
End Sub
Public Sub CtlCal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
objMonthEvents.Add("This is a test")
End Sub
End Class
End Namespace
Regards:
Steve
|
|
|
|
|
I am new to .Net and am programming in VB.Net.
Printing a Form in a report fashion (release 2.2)
By sylvain2222 is code in The Code Project.
I tried to download the demo code and use it but I keep getting compile errors as these below:
C:\Inetpub\wwwroot\PrintingFormDemo\FormPrinting\FormPrinting.cs(45): The type or namespace name 'HorizontalAlignment' could not be found (are you missing a using directive or an assembly reference?)
C:\Inetpub\wwwroot\PrintingFormDemo\FormPrinting\FormPrinting.cs(61): The type or namespace name 'Windows' does not exist in the class or namespace 'System' (are you missing an assembly reference?).
I am not a C# programmer but I would like to use slvain2222 code in my VB.Net project. However, I cannot even get the demo to compile.
If I ever get it to compile, how do I incorporate it into my VB.Net project?
Thanks for any help given.
MrMagic
|
|
|
|
|
This is the source code
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.SqlClient
Imports System.Data
Private str_connection As String = "workstation id=""MAX-IT10Q0"";packet size=4096;integrated security=SSPI;initia" & _
"l catalog=Addressbook;persist security info=False"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnsql As SqlConnection
Dim load_dataset As New DataSet
Dim rpt As ReportDocument
Dim str_query As String
rpt = New ReportDocument
rpt.Load("..\CrystalReport2.rpt")
cnsql = New SqlConnection(str_connection)
cnsql.Open()
str_query = "select name,Address from tb_abook"
Dim load_adapter As New SqlDataAdapter(str_query, cnsql)
load_adapter.Fill(load_dataset, "tb_abook")
rpt.SetDataSource(load_dataset)
CrystalReportViewer1.ReportSource = rpt
End Sub
Report :Crystelreport 9.0
Os: XP
visual studio.net 2003
Username: jeeva
Password: vk26353
Continue...
|
|
|
|
|
I have built a web form in VB.Net ver 1.0 using .Net Framework 1.1.
I have 2 data grids and some text boxes. I need to be able to print the form but I have a few problems.
1] The data grid extends to multiple pages. I could skip paging and have one long page but then the printing of the grid would be compromised.
2] I tried to use the embedded Crystal Reports to create a report that could be printed. This worked great except that the hosting web site is a shared hosting site and does NOT support Crystal Reports. I then tried to create a .MSI file but the site would not execute the Windows Ibstaller.
3] I then found this code in The Code Project:
Printing a Form in a report fashion (release 2.2)
However, I cannot get it to work with my web form.
Maybe it only works for Windows forms. I am not sure.
I am relatively new to the .Net arena and am not sure how to incorporate the FormPrint.CS code with my .Net project.
The code was written by Sylvain2222 in The Code Project
If anyone knows how I can print my web form please help.
Thanks for any help given.
|
|
|
|
|
If u have a windows form which form have a multiple textbox connected a database, like NAME,SURNAME,MOTHERNAME,FATHERNAME ...etc and i want to write code for get button..
If user fill only NAME textbox GET button must bring data in Datagrid from database where NAME=txtname.text, but if user fill some different textbox like NAME and MOTHERNAME GET button must bring data in datagrid from database where NAME=txtname.text AND MOTHERNAME=txtmname.text. Or different much more criteria.
Sorry for my bad English and thank you for your valuable replies about my problem
MAGICIANMERLIN
|
|
|
|