|
Alternativly just use the FontDialog provided in the System.Windows.Forms namespace to let the user select the font, size, style and everything. That way all the hard work is done for you by Microsoft.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
|
|
|
|
|
i already try it but the requirments are little bit different i must fill the combo with fontname, other combo with fontsize, other combo with fontstyle and these combo are on a toolstrip.
thnx
|
|
|
|
|
i am writing a program where the user enters data into a windows form
and then saves that data to a database, i then want the user to click
a button that sends an email to there department manager with a summary
of the data entered.
the question is what would be the best way to approach this? i was
thinking of either producing a report and sending that as an attachment
or somehow have the data entered in to the body of the email.
any suggestions please
|
|
|
|
|
IETaxguard wrote: the question is what would be the best way to approach this? i was
thinking of either producing a report and sending that as an attachment
or somehow have the data entered in to the body of the email.
That's entirely up to you. It depends on what the use wants to see. If they want to see a report, you can pick whatever format you want for it, that exports a file anyway, like PDF, and use one of the publicly available PDF writersto print to a file and attach it to the email, or you can send it as formatted text in the body of the email. It's entirely up to you.
I personally, like to see nice emails with a report...
|
|
|
|
|
I am trying to insert record into and SQL Server 2000 database and I keep getting the following error:
Cannot insert the value NULL into column 'ItemID', table 'RAM.dbo.Item_JS'; column does not allow nulls. INSERT fails.
The statement has been terminated.
The column ItemID is set to autonumber in the db. Here is my code:
Dim myConnString As String = "Data Source=********;Initial Catalog=******;User ID=*****;Password=*****;"<br />
<br />
Dim myInsertQuery As String = "INSERT INTO Item_JS (ItemPartNumber, ItemSourceCode, ItemSupercede, ItemCost, ItemName, ItemListPrice, ItemLastUpdateDT, ItemStatus, ItemCreationDt, CompanyID, StoreID, BrandID, PackageID) VALUES('" & Trim(partnumber) & "', '" & Trim(sourcecode) & "', '" & Trim(supercede) & "', CONVERT(MONEY,'" & cost & "'), '" & Trim(itemname) & "', CONVERT(MONEY,'" & listprice & "'), '" & Trim(lastupdateDt) & "', '" & Trim(status) & "', '" & Trim(insertdate) & "', '" & Trim(companyID) & "', '" & Trim(storeID) & "', '" & Trim(brandID) & "', '" & Trim(packageID) & "'" & ")"<br />
<br />
Dim myConnection As New SqlConnection(myConnString)<br />
myConnection.Open()<br />
Dim myCommand As New SqlCommand(myInsertQuery, myConnection)<br />
myCommand.ExecuteNonQuery()<br />
myConnection.Close()
Any Ideas?
jds1207
|
|
|
|
|
Have you tried inserting a value in the ItemID field? It is supposed to autonumber, but, from your comments, it doesn't appear to.
For what its worth, I DETEST autonumber... it has and is causing me to get heartburn... rather than autonumber, use a transaction or something to get the last value used and increment it for your insert.
Tim
|
|
|
|
|
Am using vb.net 2003, i was used to the drag and drop style of adding adapter's in my project, now am going down to code everything, when i create a data, adapter, i code them behind. before when i drag and drop the adapter in the form, i could call that adapter in my Button. i have the Following code that i have wrote in my form load
Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id= sde; Password=topology;data source= SGIICORNETGS01;persist security info=False;initial catalog=Tshwane_Valuations"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
'set up data adapter
Dim strSql As String = _
"select Actual_Extent,Attrib_code,Lis_key,Func_key,Density," _
& "New_Net_Usable_Extent,New_Total_Land_Factor,New_AdJ_Extent_1,New_Points_1," _
& "New_ADJ_Extent_2, New_Points_2, LS_Prediction, LS_Confidence,LS_TYPE from Property_Mass "
Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
'load the Data set
Dim ds As DataSet = New DataSet
da.Fill(ds, "Property_Mass")
'set up data Adapter Object
Dim strErrorMsg As String
Dim strerror As System.Data.SqlClient.SqlError
'set up the data soruce
strSql = _
"select Property_Mass.Actual_Extent,Property_Mass.Attrib_code,Property_Mass.Lis_key,Property_Mass.Func_key,Property_Mass.Density," _
& " Property_Mass.New_Net_Usable_Extent,Property_Mass.New_Total_Land_Factor,Property_Mass.New_AdJ_Extent_1, Property_Mass.New_Points_1," _
& " Property_Mass.New_ADJ_Extent_2, Property_Mass.New_Points_2, Property_Mass.LS_Prediction, Property_Mass.LS_Confidence, Property_Mass.LS_TYPE," _
& " Property_Summary.Purchase_Date, Property_Summary.Purchase_Price" _
& " from Property_Mass, Property_Summary" _
& " where Property_Mass.Lis_key = Property_Summary.Lis_key"
da = New SqlDataAdapter(strSql, cn)
'load a Dataset
Try
da.Fill(ds, "Property_Summary")
' BindingSource(bindingSource = New BindingSource)
'Close the Connection
cn.Close()
'Create relations
ds.Relations.Add("Property_summary_Mass", _
ds.Tables("Property_Mass").Columns("Lis_key"), _
ds.Tables("Property_Summary").Columns("Lis_key"))
'Bind the data set to the grid.
'Assumes that Grid contains a reference to a
'system.windows.datagrid
DataGrid2.SetDataBinding(ds, "Property_Mass")
'sorting the Datagrid
DataGrid2.AllowSorting = True
Catch ExSQL As System.Data.SqlClient.SqlException
'''All this will trap all data Problems and Network if available
For Each strerror In ExSQL.Errors
Next
Select Case strerror.Number
Case 17
strErrorMsg = "Missing server"
Case 4060
strErrorMsg = "Missing database"
Case 18456
strErrorMsg = "Missing user name or password"
Case Else
strErrorMsg = strerror.Message
End Select
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ExcpInvOp As System.InvalidOperationException
MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch Excp As System.Exception ' generic exception handler
MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
This code is working well and it display my dataset results on load. So i have included a Button to Search for a certain Column,but now when i try to use "da" which is the adapter declared in Form load,trying to access it from the button i have placed in my form. it complains about declaration. i understand everything in a form load is Private and the buitton itself is private,
1) how can i declare the adapter and the connection objects to be on the same scope when you drag and drop them on the form?
2)And from my search, am searching from a Field that has (## ## ## ## ##) numbers in a string Field, and i have to rearch by retrieving the first four,i can do that in SQL by using substring, tell me how can i achieve this and display the data in the datagrid.?
Vuyiswa Maseko
|
|
|
|
|
The scope as you've written the code, is the life of the Form_Load sub. Anything you Dim in the Sub is destroyed when execution leaves the Sub.
Vuyiswamb wrote: 1) how can i declare the adapter and the connection objects to be on the same scope when you drag and drop them on the form?
You can't. Their code is created in different places.
Vuyiswamb wrote: 2)And from my search, am searching from a Field that has (## ## ## ## ##) numbers in a string Field, and i have to rearch by retrieving the first four,i can do that in SQL by using substring, tell me how can i achieve this and display the data in the datagrid.?
I think you're asking about what the SQL SELECT would look like??
SELECT columns FROM table WHERE someColumn LIKE @Pattern
In your code, you'd add a SqlParameter object, with the parameters name @Pattern to the SqlCommand object this SQL is in and set it's value to something like "39 49 20 10 %". THe percent sign is the "wildcard" and will match anything else after the initial string.
|
|
|
|
|
hi all
i need to move the toolbar on the form
will some one let me know how to do that
thnx
|
|
|
|
|
I'm assuming you use a toolstrip for this
if so you can do this very easaly
just select the toolstrip and then in the tasks window (the little arrow on the upper right corner of the control or the gray area under the properties window) select 'embed in toolstripcontainer' then just put the toolstripcontainer dock property on fill.
after this the user can move the toolstrip around the form (all controls added to the form must be in the toolstripcontainer)
the 'gripstyle' property of the toolstrip has to be set to 'visible'
|
|
|
|
|
thnx for the help
but it not just working
i select the toolstrip and then select embed in toolstripcontainer this make a new container
then when i put the toolstripcontainer dock property to fill then it fills the whole form
i have
2 toolstrip
one ruler
one erichtextbox and
one statustrip
plz tell me what m i forgeting
|
|
|
|
|
trying switching off docking
switchimg off auto size then move the tollstrip to where you wish it to be and then use the anchors.
This works with tools trips dont know about the containers though.
HTH
MArtin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
I'v tried emailing you an example project but I keep getting an delivary failure
can you provide me with a working email acount
|
|
|
|
|
I've tried both emails you send me but they don't work
can you provide me with an hotmail, google, yahoo mail account
those are the safest and generally never cause any problems
|
|
|
|
|
|
Hi all
Just need some advice and help with the issue of Threads..Just come over from VB6 and not to sure about this one..
I have an application which waits for HTTP requests which is the main process. Once a request is recieved a thread is started to do something..on the Main Form i have a status Textbox which i want to keep up to date with the HTTP requests and also when the thread has finished etc.
Please advise as to how i may achieve this
TIA
|
|
|
|
|
Since all Controls normally get created by the main thread (aka "GUI thread")
and should be handled only by the thread that created them (they are not
thread-safe), one needs a special technique to access them from another thread.
The Control class has some members to support this: the InvokeRequired property
and the Invoke() or BeginInvoke() methods. I suggest you read up on these;
examples are plenty on CodeProject. There is one in my Sokoban article (that's
in C# but the concept is exactly the same).
|
|
|
|
|
How can set focus to a particular tabpage in vb.net 2005
|
|
|
|
|
Isn't there a selected tab property ? Assuming you're asking about winforms.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
indeed there is
and the code would look like this
tabcontrolname.selectedtab = tabpagename
-- modified at 7:57 Tuesday 31st July, 2007
you could also use selectedindex but then this will stop working properly if you change the order of the tabs
|
|
|
|
|
really , thnks my frnd .. its working
|
|
|
|
|
glad to be of assistence
|
|
|
|
|
really thnks my frnd.. its working..
|
|
|
|
|
Hello,
first of all I am new to .net and don't know much about connection pooling. I have read few articles from .net but still don't get answer for few questions.
my boss came to me and told me to do some research on connection pooling and write application that will have six buttons. three button will get connection from pool and other three button will close this connection one by one. I wanted to put one more button to destroy all connection that works fine using Clearallpools but clearpool doesn't work. I can post code here if anyone want to look at it.
Thank you.
Viral
|
|
|
|
|
.NET handles it's own connection pooling, you should not write your own.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|