|
So replace your current Graphics.DrawImage() with one of its overloads, allowing to specify exactly which part of the image needs to be drawn.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
My code for storing the data:
If Len(strJnts) > 0 Then
_gblString = CreateGUIDString()
gblConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\JWI\Data\JWI.mdb;Jet OLEDB:Database Password=jWi;")
strData = "INSERT INTO LOLItems (LOLItemsID, LOLIFormID, Type, TextBox, MaterialsID, Units, DateCreated )" _
& " VALUES ('" & _gblString & "', " _
& "'" & _frmGuid & "', '" _
& 1 & "',' " _
& strName & "',' " _
& _MATGuid & "',' " _
& strJnts & "',' " _
& Now() & "');"
gblCMD.Connection = gblConn
gblCMD.CommandText = strData
Dim cmd As New System.Data.SqlClient.SqlCommand
gblConn.Open()
gblCMD.ExecuteNonQuery()
End If
The value of _MATGuid is gathered from the tag property of a label. In the immediate window:
? _MATGuid
"55368562-a5c5-429d-a491-e1bb24f37836"
? strdata
"INSERT INTO LOLItems (LOLItemsID, LOLIFormID, Type, TextBox, MaterialsID, Units, DateCreated ) VALUES ('{6b8da5a3-fbad-4140-af9a-2728a9e35af6}', '{a6a0e519-aa21-48b0-b26a-839caed800c7}', '1',' txtRodE_1',' 55368562-a5c5-429d-a491-e1bb24f37836',' 10',' 6/4/2010 9:47:40 PM');"
In Access the value for MaterialsID for the record ended up being:
{05F3C3FC-D57C-7047-0200-00000000E927} It is a Number field, ReplicationID, Indexed (Duplicates Allowed)
When I saved 14 record at a time I got the following- It seems like they are GUIDS being generated by Access as they are so similiar.
MaterialsID
{05A5C29C-D57C-7047-0500-00000000EA35}
{05A5C29C-D57C-7047-0100-000000009A3E}
{05A5C29C-D57C-7047-0400-000000001A48}
{05A5C29C-D57C-7047-0000-00000000BA28}
{05A5C29C-D57C-7047-0200-000000009A30}
{05A5C29C-D57C-7047-0200-000000009A43}
{05A5C29C-D57C-7047-0400-000000003A34}
{05A5C29C-D57C-7047-0000-00000000DA41}
{05A5C29C-D57C-7047-0300-000000002A45}
{05A5C29C-D57C-7047-0700-000000007A3B}
{05A5C29C-D57C-7047-0300-00000000AA31}
{05A5C29C-D57C-7047-0500-000000009A49}
{05A5C29C-D57C-7047-0600-000000007A39}
{05A5C29C-D57C-7047-0100-00000000BA2C}
The values that the _MatGuid SHOULD have been are shown below:
55368562-a5c5-429d-a491-e1bb24f37836
2fa63b3f-2399-4503-a1a6-91249c21bada
16221dca-6f9b-47ba-a733-b38e4f40ad96
526748be-209d-4cb2-abae-3e9fc6e188d3
aaecd995-dbb9-4bf0-a461-474b4cbe590f
3cf2864b-c1fd-4b46-b588-9c1d89d08eac
d131d5d7-b925-424d-b791-df2a322f0123
d06af1df-3233-495f-bd26-610dd09b1b12
b2b63ef0-42b5-4d80-9bfe-ced762db2e42
b7bbeaef-79d8-4b36-be69-26484f8e4fe5
002f9e90-3b33-4910-b18a-b80930ceb838
442b44fd-0427-433e-9d76-d0b3c79e279c
bbb3eca6-e71e-47b3-866d-b6795166b65f
a7e9f919-92d9-45db-a6c5-de1b7f393381
I don't see where or how it can get changed or corrupted.
Any suggestions greatly appreciated.
Larry
modified on Friday, June 4, 2010 11:26 PM
|
|
|
|
|
First, your values have spaces in them. Second, your GUID in question doesn't have curly brackets around it, possibly making it an invalid GUID. Third, GUIDs are probably overkill for your ID's.
Lastly, do NOT use string concatentation to build your SQL statements. Use parameterized queries instead. The parameter objects will handle correctly formatting your values for you instead of you guessing at what they should be and (cardinal sin here) you using values directly out of textboxes completely unvalidated and unnormalized.
|
|
|
|
|
Not used Access for some years but IIRC Access will generate values for ReplicaID fields.
You should only use this type if you are using replication and have the Replication Manager. As far a I remember without it replication was painful.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Please!
I need some vb6 code to parse these, especially vhosts.conf. Even vb.net code can help.
Thanks.
|
|
|
|
|
This[^] is the best your going to get. We're in the business of supplying finished code to do things.
|
|
|
|
|
Thanks God I shouldn't pay Google for that.
Listen, I don't say I want it for free!
Are you just in a bad mood?!
|
|
|
|
|
No. It's just you're about the 5 millionth person to show up saying "I want code for ____!".
I believe in writing your own code so you can learn. You're also asking for something that is very rarely ever used. You're not likely to find prewritten code for this.
|
|
|
|
|
what's the vb.Net counterpart of the following blocks in Csharp?
public class NullableDateTimePicker : System.Windows.Forms.DateTimePicker
{
public NullableDateTimePicker() : base()
{
base.Format = DateTimePickerFormat.Custom;
NullValue = " ";
Format = DateTimePickerFormat.Custom;
CustomFormat = "dd MMM yyyy";
this.DataBindings.CollectionChanged += new CollectionChangeEventHandler(DataBindings_CollectionChanged);
}
}
class DateTimePickerEditingControl : NullableDateTimePicker, IDataGridViewEditingControl
{
public DateTimePickerEditingControl()
{
this.Format = DateTimePickerFormat.Custom;
this.CustomFormat = "dd MMM yyyy";
}
}
|
|
|
|
|
You know, that there are tools for conversing code from C# to VB.Net, do you? Just google for them.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Never mind. I was making a small mistake.
In block 1 it should be:
MyBase.New
In block 2 it should be:
class DateTimePickerEditingControl<br />
Inherits NullableDateTimePicker<br />
Implements IDataGridViewEditingControl<br />
End Class
I was writing this in the first place:
class DateTimePickerEditingControl<br />
Inherits NullableDateTimePicker, Implements IDataGridViewEditingControl<br />
End Class
|
|
|
|
|
|
Greetings everyone,
I'm going through Stephen Toub's book "Patterns of Parallel programming" to try and figure out the different tips and tricks of parallel programming.
Besides having found few minor errors in the book already, I'm stuck on the example described on page 71:
Public Const NUM_STEPS As Integer = 1000000
Shared Function ParallelLinqPi() As Double
Dim [step] = 1.0 / CDbl(NUM_STEPS)
Return ParallelEnumerable.Range(0, NUM_STEPS).Select(
Function(i)
Dim x = (i + 0.5) * [step]
Return 4.0 / (1.0 + x * x)
End Function).Sum() * [step]
End Function
The VS underlines this whole chunk of code and explains the following:
"Overload resolution failed because no accessible 'Sum' accepts this number of arguments."
Apparently, the Sum() function at the end needs to have a selector (selector As System.Func(of Object,Double)). There is no mention of this in the book =(
What should I write inside the Sum, to make this example work, any ideas?
Thanks...
Agarwaen
|
|
|
|
|
The code you posted works perfectly in VS 2010. Are you using 2005 or 2008?
|
|
|
|
|
I use VS 2010 and get the error described in my message above. That is why I'm stumped, because according to the book it should work, but it doesn't =(
Perhaps I need to import some specific namespace ? If so plz tell me which one...
|
|
|
|
|
Are you using one of the 2010 Betas? I tried it on the VS2010 RC1 release, just created a new standard Console app, typed the code in and it worked.
The only namespace required is System.Linq .
|
|
|
|
|
Darn it, I've figured it out...
Here's how the code should look like:
Public Const NUM_STEPS As Integer = 1000000
Shared Function ParallelLinqPi() As Double
Dim [step] = 1.0 / CDbl(NUM_STEPS)
Return ParallelEnumerable.Range(0, NUM_STEPS).Select(
Function(i)
Dim x As Double
x = (i + 0.5) * [step]
Return 4.0 / (1.0 + x * x)
End Function).Sum() * [step]
End Function
Small errors as this one in the book are beginning to drive me nuts =(
Thank you for your effort Dave Kreskowiak.
*Back to reading the book /*
Agarwaen
|
|
|
|
|
Odd. I used the code EXACTLY (verified 3 times by 2 people) as you originally posted it and it worked fine.
|
|
|
|
|
Dear,
since iam new to vb.net,please help me to pass parameter to for my VB.net project,
here is my code for passing parameter to stored procedure
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim combo As String
Dim SQLEV As SqlClient.SqlConnection = New SqlClient.SqlConnection
SQLEV.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=db_chart;server=nrppc-mis1\sqlexpress"
combo = ComboBox1.SelectedValue.ToString
Dim command As New SqlCommand("usp_Procedure", SQLEV)
Dim adapter As New SqlDataAdapter(command)
command.CommandType = CommandType.StoredProcedure
With command.Parameters
.Add(New SqlParameter("@Ridfrom", SqlDbType.NVarChar))
.Add(New SqlParameter("@PidTo", SqlDbType.Money)).Direction = ParameterDirection.Output
.Add(New SqlParameter("Returnvalue", SqlDbType.Int)).Direction = ParameterDirection.ReturnValue
End With
End Sub
this is my stored procedure
ALTER PROCEDURE usp_Procedure
@Ridfrom nVarChar(50),
@PidTo nVarchar(20) output
AS
SELECT @PidTo = ProcDetails.Procedure_ID
FROM ReportMaster INNER JOIN
ProcDetails ON ReportMaster.Procedure_ID = ProcDetails.Procedure_ID
WHERE ReportMaster.Report_ID = @Ridfrom
RETURN
|
|
|
|
|
What is the problem apart from the fact that you never execute the command?
You should open an SQLDataReader using
myDataReader = command.ExecuteReader
to get the result of the stored procedure
|
|
|
|
|
Hello ,
I wanna create an VB6 Appln, in which each number between 0-9 has different forecolor .And when the number is pressed specified forecolor for that number should set in cell.Eg: If 0 = Red, 1=Green, 2 =Blue. When 0 is pressed its forecolor should be red and when 1 is pressed its forecolor should be Green and so on. And When 12 is pressed 1=Green and 2=Blue. Can anybody help me to achieve this.Any suggestion Appreciated.What should i start with?
Regards
Rizwan
|
|
|
|
|
mdrizwan_1 wrote: I wanna create an VB6 Appln,
A what? Are you saying that you want to create an Excel AddIn in VB6?
|
|
|
|
|
Hello Dave Kreskowiak,
Thanks for your response. You may assume it as an AddIn. Its a mini project where i can enter number with different colors and save it in Excel or any supportable format. and it should be editable. Any suggestion appreciated?
Regards
Rizwan
|
|
|
|
|
I've never written an Excel AddIn in VB6 and I recommend you don't either. I'd use something far more up-to-date, like VB.NET. You can find examples with a little application of Google. Here...[^]
|
|
|
|
|
Hello Dave,
Thanks for the link .Can you help me for a start ???
Regards
Rizwan
|
|
|
|