I'll help change your button2 then:
Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
For Each dir In dirs
...
'Do anything you want with f.FileName
...
Next
I'll help change your button2 then:
Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
For Each dir In dirs
...
'Do anything you want with f.FileName
...
Next
Not an expert (yes, a newbie!), but, are you using Access database? Then 'LIKE @' was wrong, use 'LIKE yourString' instead will do the trick (or not?).
For every types of file or for excel, use:
Process.Start(FilePath.Trim"\"+Filename.Trim+".xls")
It's hard to tell, it bases on the type of file you are using. The common way was to fill a dataset with your data from your file, then fill data from dataset to your array.
We don't do print to form in VB.Net, but I can suggest some objects like ReportViewer. In my case, I prefer using CrystalReport so I'm using CrystalReportViewer quite often, it show a copy of what you are going to print and even let you save your printing to .doc,.pdf or .xls.
Try this:
yDTable.Columns("IndexChangeColName").SetOrdinal(IndexYouWantingToChangeTo)
I'm not sure about this, but this will change the position of your column and is there're multiple columns to change - like n columns, etc... - you must use this line n times to change all the columns' position.
yDTable.Columns("IndexChangeColName(1)").SetOrdinal(IndexYouWantingToChangeTo(1))
....
yDTable.Columns("IndexChangeColName(n)").SetOrdinal(IndexYouWantingToChangeTo(n))
@nashy: You welcome :)
Magical! Thanks!
Then you could add your project first then create a subfolder in your installation project to add your crytal reports later? I'm using VS.2005 and everythings was fine till now.
I'm not an expert in SQL but I'll give it a try:
1. Creating a procedure to update 'materialsdetails' table, but update both 'materialsdetails' and 'Products' together. That proc might contain query such as (my suggestion only):
UPDATE Products SET TotalCost = 'OldTotalCostValue' + 'NewMaterialsValue' - 'NewMaterialsValue'
WHERE ProductsId IN (SELECT * FROM Material WHERE MaterialId ='EditMaterialsId')
My solution is: Creating an array of buttons with your buttons then loop through it together with your SQL columns.
Did tried them all, at last I decided to fix the .dll. Thing's all fine now :)
Here's your code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = TextBox1.Text.ToUpper()
End Sub
Tried this once, actually, my button did go like an old motorbike :D
My solution was Using .top and .left property and a timer.
Clicking the destination start the timer, every tick myBtn move ((myDestination.top-myBtn.top)+(myDestination.left-myBtn.left))/1000n (using n makes sure you can handle the time your object move).
First I increase myBtn.top to where myBtn.top = myDestination.top I will start increase myBtn.Left to myBtn.Left = myDestination.Left.
When myBtn.Left = myDestination.Left and myBtn.top = myDestination.top I stop my Timer.
Ha ha, pretty simple huh =))
@Begginnerdev: Yes, I did saw it, but I couldn't find a possible sulution there :(
@eos.park: It's not the problem whether I use .show() or .showdialog(), it's a problem of a custom .dll which I cannot fix. Anw, thks :)
Oh, sorry for my bad eyes. I still think it's possible, my friend's suggestion, though. I'm talking with him about your problem and he said it's possible in C#, so I think it might be in VB.Net...
You welcome!
I noticed you are new here, so remember to mark your question as "Solved" after it's solved. That'll help the others who seeking the same answer. Good luck with your job :)
Is there a way to set a window to the top on screen and set focus on it?
I'm having a menu in VB.Net calling a bunch of .exe. Everytime a window apears, it runs itself to the top on screen. But there was a window, problem-able one, with some .dll which make it always stood behind everthing on screen. I cannot fix the .dll, so I'm trying to get the screen to go to the top with my code.
I tried:
Me.Activate()- Nothing happens...
Me.BringToFront()- Nothing happens...
Me.TopMost = True- Always on top, but no focus (dvmn it!!!)
Please help!
Yes, yes and another yes. There're even some full samples for AD in VB.Net if you try google-ing around. Good luck!
'e' values stands for '10' in Decimal, jusy say: a kind of mathematics symbol. For example: Double says: "e", Decimal says "10"... Btw, I'm also a newbie then learning things also feeling good for me.
First, fill those data into a dataset:
Dim ds As DataSet = DirectCast(DirectCast(Dgv, DataGridView).DataSource, DataSet)
To XML:
ds.WriteXml("Your path" + "\your xmlname".xml)
To Mdf? I'm not sure, but, did you want to insert those data into a database? You should have a database, a table, a connection, an adapter, a query... My idea: Please search FAQ for "insert data into Access database, VB.net".
Try: .refresh(), then .items.clear(), then invalidate()
I agree with Begginnerdev, since Int32 is normal interger, Int16 is "Short" interger, Int64 is "Long" interger.
@Don,
Double show 'e' values when Decimal not (so, not everything is "number"). Someone told me to use Decimal when coding accounting projects and Double for mathmatics ones, not really know the reason.
The solution with ShowDialog and a BackGroundWorker was a success. Many thanks guys! :)
I suggest that your 'stateSlsTax' has not been set as Decimal, try this code instead:
Dim stateSlsTax As Decimal
stateSlsTax = Convert.ToDecimal(txbStateTaxPcnt.Text)
txbStateTaxPcnt.Text = stateSlsTax.ToString("n2")
If this one not working corectly, I think you should check if there are any '.Trim()' things around your code.
Just use ToDecimal(). Works everytime.
gusano79 solution is right for all objects. But I suspect you are tagging picturebox here, so how about using RotateFlip() to Flip the image inside the picturebox but not a whole picturebox itself?
Well, CInt with a string is not possible. Try CChar(), or replace ".grand_total " with some Int value.
Thks, Begginnerdev solution gave me a hint. Instead of using Show, I'm using ShowDialog and a BackGroundWorker now, but still couldn't find a way to solve it without a timer. Anyway, finally having a way, though.
I think it probably the same. You can change "Ct='abc'" with your query and "Ct" with your sorting column.
Dim Dr() As DataRow
Dr = dt.Select("ct = 'abc'", "ct")
For i As Integer = 0 To Dr.Length - 1
dt.Rows.Remove(Dr(i))
Next
Thks for the answers, I've already had a different splashscreen for the loading screen and another for loading submenus (which I'm asking for help here).
In the previous version, I used to use timer and 'thread.sleep()' to solve the problems but now I want to make things a lil bit better. Is there a way?
How' bout set WindowState to Maximized?
Form1.WindowState = FormWindowState.Maximized
May you try:
dt.AcceptChanges()
dt.Rows.Remove(row)
With 'row' is the row which you want to remove.
I'm having a nightmare here!
I'm calling 2 different forms, one like a loading screen and the other is the working form. The trick here is placing the 'SplashScreen1.Close()' at the end of Form2 and it will automatically close the loading screen when Fom2 finish.
But I could never get PictureBox inside SplashScreen1 to display nmw. Pls, help me!
Here's my code:
SplashScreen1.Show()
Form2.Show()
Could you guys show me how to create a progess bar which discribes the process of a SQL procedure?
Thks a lot, I'll change my code in your way and give it a try. ^^
What I tried was using My.Computer.Network.DownloadFile()
, and created a shared folder in the other computer to do downloading stuff.
But, in fact I didn't know how to fill the path to the other computer, the error was: "...path not supported..."
How about this:
ServerName1 = cmbServerName1.Text.Trim()
database = cmbDataBase1.Text
If objdlg.ShowDialog = DialogResult.OK Then
My.Computer.Network.DownloadFile(New Uri("\\" & cmbservername1.Text & "\SharedNow\"), "C:\database.txt")
EndIf
Okay, that's what I did, and it's not working. Could someone help me, pls?
I have a combo box which help me select SQL servers in my local computer, but now I want it to be able to select just any connected servers (like remote servers) as possible, how could I solve it???
Sub server(ByVal str As String)
con = New SqlConnection("Data Source=" & str & ";Database=Master;integrated security=SSPI;")
con.Open()
cmd = New SqlCommand("select * from sysservers where srvproduct='SQL Server'", con)
dread = cmd.ExecuteReader
While dread.Read
cmbservername1.Items.Add(dread(2))
End While
dread.Close()
Thanks for your help, but as you could see, I had already set these as you said and... nothing happened. I wish that we could even disable Tabstop, but TabStop = False do "Nothing". I wonder if there's a way to solve this, really!!
In a data grid, I have a data grid with a column like this:
Dim colAdd As New HeaderAndDataAlignColumn
With colAdd
.MappingName = "Address"
.HeaderText = "Nationality"
.Width = 150
.Alignment = HorizontalAlignment.Center
.TextBox.Enabled = False
.ReadOnly = True
.NullText = ""
End With
How can I disable this column entirely, I mean even disable focus event (can't click, can't use Tab or arrow keys, etc.)
Okay, I got it. May be I'll set this to solved, noone seeing this anyway!
No one's helping, yet??? Oh, I'm needing this so bad, could smone help me, pls??? :(
How could I change the column header of the Data Grid to center or right but not left as default?
[Pls pay attention, We are talking 'bout Data Grid here, recently I always receive answers for Data Grid View instead :( ]
I just want to re-align the header only, not the whole column. There's another topic discussed bout this already but it's not working in my case. Could somebody help me? Here is my code:
Public Class Form1
Private Sub DataGrid1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles DataGrid1.Paint
Dim row As Integer
Dim p As Point
Dim yChange As Integer
Dim y As Integer
Dim RowText As String
Dim hti As DataGrid.HitTestInfo
p = New Point(DataGrid1.GetCellBounds(0, 0).X + 4, DataGrid1.GetCellBounds(0, 0).Y + 4)
Static FirstLoad As Boolean = True
Try
hti = DataGrid1.HitTest(p)
row = hti.Row
yChange = DataGrid1.GetCellBounds(row, 0).Height + 1
y = DataGrid1.GetCellBounds(row, 0).Top + 2
While (y <= DataGrid1.Height - yChange And row < DataSet11.Tables("nhanvien").Rows.Count)
RowText = (row + 1).ToString
e.Graphics.DrawString(RowText, DataGrid1.Font, New SolidBrush(Color.Black), 12, y)
y += yChange
row += 1
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
DataGrid1.DataSource = DataSet11.Tables("nhanvien")
DataGrid1.TableStyles.Clear()
Dim ts As DataGridTableStyle
ts = New DataGridTableStyle
ts.ColumnHeadersVisible = True
ts.MappingName = "nhanvien"
For Each column As DataColumn In DataSet11.Tables("nhanvien").Columns
Dim columnStyle As New DataGridTextBoxColumn
columnStyle.MappingName = column.ColumnName
columnStyle.HeaderText = column.ColumnName
columnStyle.HeaderText = column.ColumnName
columnStyle.Alignment = HorizontalAlignment.Center
ts.GridColumnStyles.Add(columnStyle)
DataGrid1.TableStyles.Add(ts) …
Thanks Ezz, I didn't ask for DataGridView but I finished it based on ur idea. Great help! :)
Thks, but my problem here is that I can't change DataGrid RowHeader to auto-generated numbers by VB.Net code, not by SQL. Any options?
I have a DataGrid table like this: [img]http://ni8.upanh.com/b1.s24.d1/f869170161faa9e6ad2c272d6f66228e_40513398.capture.png[/img]
How could I change the plain-looking arrows in the RowHeader into row number (Like 1,2,3...)???
Thanks for any help from you guys!
Please, if anyone have a full source code for Mobile shop management or have a project look similar to 'that' so please let me borrow it. Many thks for any helps here!!!
Let's check things again: I want to have a Crystal Report which print what being shown in DataGridView; and on DataGridView there is a column which enables us to pick Print/Not Print the row contains it - eg: A blank column to insert variable, numbers, etc. The variables here should be 0, 1. Would that be possible?