|
You want to use something like:
gridView.Columns("yadayadayada").HeaderText = "UseTheForce"
DisplayIndex is also worth looking at as it will allow you to re-order the columns.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
dear all,
i want to read a dxf and extract entities data for polyline to be used later
i already read the dxf file but i do not have any idea how to extract the required section from it
my code was
Public Sub Dxf_Reader(ByVal file As String)
Dim tag As IO.StreamReader
Dim txtarray As String()
If infile = "" Then Exit Sub
tag = IO.File.OpenText(infile)
txtarray = tag.ReadToEnd().Split(New String(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries))
tag.Close()
End Sub
|
|
|
|
|
|
Apologoes if this the wrong forum – could be in “Database”, or even C# - it’s a bit of a cross-over...
The scenario:
I have a database table holding records of items that are flagged according to various key terms held in another table – eg:
keywords table:
ID – integer
sKeyword – string
There are about a dozen of these, which won’t change, with ID’s from 1 to 12.
items table:
ID – integer
iKeywords – Double
(other fields)
The iKeywords number is calculated simply as the sum of 2 ^ keywords.ID for all relevant keywords. A record may be associated with multiple keywords. Thus it is easy to select records matching keywords criteria, and updating records is similarly easy.
The problem:
Give the iKeyword value of a particular item, find other items which are matched with some or all of the keywords of this record, ordered by the number of matching keywords.
The solution...?
Apart from an obvious brute-force approach, I am sure there must be an elegant algorithm (c# or vb .NET preferably) that can do it.... even better a really smart SQL statement, but that’s probably hoping for too much.
Or maybe I should be approaching the database structure differently?
|
|
|
|
|
Why is your iKeywords field is a double if you only have 12 keywords and they're not going to change? A 16-bit integer (smallint ) would be sufficient.
The design feels wrong; the standard approach would be to have a many-to-many relationship between the keywords and the items:
Keywords: KeywordID [PK], Keyword
Items: ItemID [PK], ...
ItemKeywords: ItemID [PK, FK], KeywordID [PK, FK]
This would lead to a fairly simple solution:
SELECT
B.ItemID,
Count(1) As MatchedKeywordCount
FROM
ItemKeywords As A
INNER JOIN ItemKeywords As B
ON A.KeywordID = B.KeywordID
WHERE
A.ItemID = @ItemToMatch
And
B.ItemID != @ItemToMatch
GROUP BY
B.ItemID
ORDER BY
MatchedKeywordCount DESC
;
With your current implementation (updated to use an integer type for iKeywords ), you can identify matching products using bitwise-AND[^]:
SELECT
...
FROM
Items
WHERE
(iKeywords & @KeywordsToMatch) != 0
;
Counting the number of matching keywords is slightly more complicated. For example:
WITH N0 (X) As
(
SELECT 1
UNION ALL
SELECT 1
),
N1 (X) As
(
SELECT 1
FROM N0 A CROSS JOIN N0 B
),
N2 (X) As
(
SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) - 1
FROM N1 A CROSS JOIN N1 B
),
PowersOfTwo (Value) As
(
SELECT Power(2, X)
FROM N2
),
MatchingItems As
(
SELECT
I.ItemID,
I.iKeywords & @KeywordsToMatch As MatchedKeywords
FROM
Items As I
WHERE
(I.iKeywords & @KeywordsToMatch) != 0
)
SELECT
I.ItemID,
Count(1) As MatchedKeywordCount
FROM
MatchingItems As I
INNER JOIN PowersOfTwo As P
ON (I.MatchedKeywords & P.Value) != 0
GROUP BY
I.ItemID
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Many thanks for this - should be enough to get me going!
I used a double only because when I began I wasns't sure of the exact keyword list, so played safe in case there were more. I agree the design "looks wrong" as it is clearly limited to only a relatively small number of keywords. I'll have a play with doing it right!
|
|
|
|
|
Sir Please tell me how to run an external exe in a frame in vb.net... it is possible...
|
|
|
|
|
Member 10279246 wrote: external exe in a frame in vb.net WinForms does not have a "frame" concept. You can change the parent of a running executable to point to your Window, as you already did. SetWindowLong[^] is used to change the border. The statusbar and toolbars aren't part of that border. The borderstyles can be found on P/Invoke[^].
..and please don't repost the exact same question. People tend to ignore duplicate posts.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Which part of "don't repost" did you not understand?
You have now posted the same question twice in this forum, and twice in QA. You haven't even had the courtesy to respond to the people who have tried to answer your previous versions of this question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
No you can't.
You can, however, open and run an external program from VB.Net.
|
|
|
|
|
Actually, you can do that. It's not very nice looking and you don't have control over the application window nor with the application itself. The user can do whatever they want with application, including putting it back to windowed mode and moving it around inside your parent window, even to the point where they can't see the window any more.
|
|
|
|
|
I want to run ms word application in my program... I have call the exe but I want to run under a frame means I do not want to show the border..
or any method to remove the frame or border of external exe
here is sample code which I got but not working
-----------------------------------------
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function ShowWindow Lib "user32" (ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
Private Const SW_MINIMIZE As Integer = 6
Private Const SW_MAXIMIZE As Integer = 3
Private Const SW_RESTORE As Integer = 9
Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
#Region " Windows Form Designer generated code "
Private Sub wordMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wordMenu.Click
Dim pinfo As New ProcessStartInfo("WINWORD")
Dim p As Process = System.Diagnostics.Process.Start(pinfo)
p.WaitForInputIdle()
SetParent(p.MainWindowHandle, Label1.Handle)
End Sub
End Class
'Here this fellow explain how to run winword under a label.. But it is not working.... or any method to remove frame of called exe
|
|
|
|
|
Member 10279246 wrote: Here this fellow explain how to run winword under a label.. But it is not working. Then you should go and ask him for help.
Veni, vidi, abiit domum
|
|
|
|
|
Kindly don't repost - I saw the same question in Q&A.
You won't be able to remove the border of the external exe unless you have their source code and can pass a parameter that suggests you are launching this program from another location.
|
|
|
|
|
i have made a table
plotno int Not Null
plotsize varchar(10) Allow Null
block varchar(5) Allow Null
sqyards numeric(5, 0) Allow Null
rate numeric(18, 0) Allow Null
plot_total_rate numeric(18, 0) Allow Null
Book_amt numeric(18, 0) Allow Null
date datetime Allow Null
referance varchar(50) Allow Null
status varchar(15) Allow Null
,i made a form plotmaster in visual basic related to the respected table field, the referance feild has combo box property where the refarance name will automatically add from agent master, which occcurs already successfully at the time of form load of plot master.i used a goup box where three radio button appear, 1-booked,2-hold,3-fresh, when user click on the respected radio button the same radiobutton text like(booked, hod, refresh) will store in status field.
here is the coding.
Imports System.Data.SqlClient
Public Class frmplot
Dim cnn As New SqlConnection("Data Source=toshiba-pc;Initial Catalog=VRINDAVAN;User ID=sa;password=zion123")
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim stable As DataTable
Dim sbuilder As SqlCommandBuilder
Private Sub frmplot_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
comboload()
txtplno.Focus()
dgvstatus2.[ReadOnly] = True
txtdt.Text = (Format(Now, "short date"))
cnn.Close()
End Sub
Private Sub comboload()
cnn.Open()
Dim strSQL As String = "SELECT * FROM agentmaster"
Dim da As New SqlDataAdapter(strSQL, cnn)
Dim ds As New DataSet
da.Fill(ds, "agentmaster")
With cmbref
.DataSource = ds.Tables("agentmaster")
.DisplayMember = "aname"
.ValueMember = "acode"
.SelectedIndex = 0
cnn.Close()
End With
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
dgvstatus2.[ReadOnly] = True
If txtplno.Text = "" Then
MsgBox("Please Enter Plot No.", MsgBoxStyle.OkOnly, "Plot Master")
txtplno.Focus()
ElseIf txtpsize.Text = "" Then
MsgBox("Please Enter Size of Plot", MsgBoxStyle.OkOnly, "Plot Master")
txtpsize.Focus()
ElseIf txtblock.Text = "" Then
MsgBox("You must Enter Block", MsgBoxStyle.OkOnly, "Agent Master")
txtblock.Focus()
ElseIf txtsyard.Text = "" Then
MsgBox("You must Enter Square Yard.", MsgBoxStyle.OkOnly, "Agent Master")
txtsyard.Focus()
ElseIf txtrate.Text = "" Then
MsgBox("You must Enter Rate.", MsgBoxStyle.OkOnly, "Agent Master")
txtrate.Focus()
ElseIf txtbamt.Text = "" Then
MsgBox("You must Enter Boking Amount", MsgBoxStyle.OkOnly, "Agent Master")
txtbamt.Focus()
Else
insert()
End If
End Sub
Private Sub insert()
txttpr.ReadOnly = True
Dim status As New GroupBox
Dim R, S As String
R = ""
If (cmbref.SelectedIndex > -1) Then
R = cmbref.Text.ToString
End If
With status
If rbuttonbook.Checked = True Then
S = rbuttonbook.Text
ElseIf rbuttonhld.Checked = True Then
S = rbuttonhld.Text
Else
S = "None"
End If
End With
cnn.Open()
cmd.CommandText = "insert into plotmaster (plotno,plotsize,block,sqyards,rate,plot_total_rate,Book_amt,date,referance,status) values ('" & txtplno.Text & "','" & txtpsize.Text & "','" & txtblock.Text & "','" & txtsyard.Text & "','" & txtrate.Text & "','" & txttpr.Text & "','" & txtbamt.Text & "',#" & txtdt.Text & "#,'" & R & "','" & S & "')"
cmd.ExecuteNonQuery()
cnn.Close()
MessageBox.Show("Data Saved Successfully", "Party Master")
txtplno.Text = ""
txtpsize.Text = ""
txtblock.Text = ""
txtsyard.Text = ""
txtrate.Text = ""
cmbref.ResetText()
txttpr.Text = ""
txtbamt.Text = ""
txtplno.Focus()
loadgrid()
End Sub
Private Sub loadgrid()
Dim sql As String = "select * from plotmaster"
Dim DataTab As New DataTable
cnn.Open()
cmd = New SqlCommand(sql, cnn)
da = New SqlDataAdapter(cmd)
sbuilder = New SqlCommandBuilder(da)
ds = New DataSet()
da.Fill(ds, "plotmaster")
stable = ds.Tables("plotmaster")
cnn.Close()
dgvstatus2.DataSource = ds.Tables("plotmaster")
'Dgvstatus1.ReadOnly = True
'Dgvstatus1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
dgvstatus2.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
End Sub
Private Sub rbuttonhld_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonhld.CheckedChanged
Dim S As String
If rbuttonhld.Checked = True Then
S = rbuttonhld.Text
Else
S = "None"
End If
End Sub
Private Sub rbuttonbook_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonhld.Click
End Sub
Private Sub cmbref_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbref.SelectedIndexChanged
Dim R As String
R = ""
If (cmbref.SelectedIndex > -1) Then
R = cmbref.SelectedItem.ToString
End If
End Sub
Private Sub rbuttonhld_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonhld.Click
End Sub
Private Sub rbuttonfresh_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonfresh.CheckedChanged
Dim S As String
If rbuttonfresh.Checked = True Then
S = rbuttonfresh.Text
Else
S = "None"
End If
End Sub
Private Sub rbuttonfresh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonfresh.Click
End Sub
Private Sub txtrate_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtrate.LostFocus
Dim ra, t, sq As Integer
ra = Val(txtrate.Text)
sq = Val(txtsyard.Text)
t = ra * sq
txttpr.Text = t
End Sub
Private Sub rbuttonbook_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbuttonbook.CheckedChanged
Dim S As String
If rbuttonbook.Checked = True Then
S = rbuttonbook.Text
Else
S = "None"
End If
End Sub
End Class
when i run the program the eror comes :--ExecuteNonQuery: Connection property has not been initialized.
where is the problem , the same syntex of insert i am using in agent master it's working,
pls do needfull and send me the solution urgently,
regard's
Anand
|
|
|
|
|
Member 10192835 wrote: pls do needfull and send me the solution urgently, It's not urgent. We're volunteers, and reply in our own spare time. I can even choose not to reply.
You should assign the connection cnn to the Connection property of the SqlCommand. As is, it doesn't know on which connection to execute your nonquery.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am having trouble getting InstallShield to install to use with Visual Studio / Visual Basic 2012.
I have downloaded InstallShield 2012 Spring LimitedEdition. The installation completed without errors. When I try start InstallShield, I get a warning dialog that states: Invalid License data. Reinstall is required.
I have reinstalled twice, but I always get the same warning. There was NEVER any opportunity to enter the serial number that Flexera Software provided.
I posted a similar query of the Flexera InstallShield forum. I also sent an email to Flexera support. Sadly, over a week and there has no response from either.
Does anyone here have any suggestions what I might try next?
|
|
|
|
|
Member 10265228 wrote: I posted a similar query of the Flexera InstallShield forum. I also sent an email to Flexera support. Sadly, over a week and there has no response from either. Go to the competition.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Why bother to make such an unhelpful comment.
Never got any help from this forum anyway.
Deleting from my favorites. Consider me gone.
|
|
|
|
|
Well it is a valid suggestion, normally we would send you to their forums for such a specific problem but as you have already exhausted that avenue the suggestion to use a different product is valid. So it was not Eddy being a smart ass it is you being overly sensitive.
And he is right it is only urgent to you, the rest of us are enjoying the weekend (I hope).
[edit] oops wrong thread [/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Member 10265228 wrote: Why bother to make such an unhelpful comment. "Unhelpful" is an opinion; IMHO it'd be the only rational and logical move. One would not want to be depending on a vendor that does not deliver as promised.
Member 10265228 wrote: Never got any help from this forum anyway. Yeah, that'll be the forums fault then?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
WOW! Considering we have TRIED to help you, I find your comment extremely offensive.
I seem to remember you had a case-sensitivity problem with a dBase database...
|
|
|
|
|
Hello,
I need to communicate between two exes. Scenario is as following:
- an application in installed on various machines in a network.
- This app will pull the data from sql server database and display to the user. The user is allowed to make modifications to that data.
- When any another user is watching the same screen on a different machine in the network I would like to refresh that screen automatically.
I do not have much knowledge on communication between exes, this is what I thought as solution:
- update db table with IP address whenever user navigates to that form, and remove the entry when he is out of it.
- update log table in db whenever data is changed on that particular form.
- Write a service on the DB server that reads this and sends messages to all the machines on the network that has this app opened and the form on display
-once the app gets the message from service the form will refresh.
Does this solution makes sense, can anybody guide me please. Though I thought of this solution I am not sure how I should communicate from service to exe.
Thanks in Anticipation.
Srinivas
|
|
|
|
|
MLSrinivas wrote: Does this solution makes sense.
No, you would be better off creating a flag table in the database that is updated when the table changes, all the other clients could then poll the that table at a set interval and update if the flag has changed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|