|
I have populated my datagrid and made some changed in our data now I want to save it to my database, don't have any idea how to? I am using dataset.
|
|
|
|
|
Hi guys!
need some help from u guys
can any one tell me how to add serial no in datagrid row header in vb.net datagrid as same as in sql2000 results pane when viewed in grid view ..
need it urgently.
bye.
abhinav
|
|
|
|
|
can u eloborate it a bit?
|
|
|
|
|
i'll try
actually i have a datagrid in one of my window form.
what actually i want is that when the data grid is populated there should be a serial no. before every row of grid
like we have column names in Column header property of datagrid.
is there any way to add serial no in row header property like it is in sql 2000 result pane when viewed in grid view with ctrl+d + f5 with any select statement.
abhinav
|
|
|
|
|
hello all,
this could be a stupid question. but for me it is a headache. i've been trying to do it for some time with no luck.
i have got a datagrid with some data. i want to write the code to send the rows of data directly into a table on the click event of a button. how is this possible. if anyone knows how please do help me.
thanks
|
|
|
|
|
First count the no of row in dataset
dim rowno as integer = dataset.row.count
for rowno = 0 to rowno 'creating a loop
dim strval as string=datagrid.items(row#,coloum1).tostring
dim insert as string = "insert into table(field)values(strval)'write the insert command here
cmd1 = new oldbcommdbuilder(insert)
cmd1.nonexecutereader
next
hope it helps you
If you still have any questions let me know i will give you detailed explanation.
take care
Regards
|
|
|
|
|
hi,
thanks for ur help. right now i am in another project team doing a project in asp.net. i will try out ur solution and let u know.
thanks,
lavanya
|
|
|
|
|
hellow to all ...
i wana to Bind to a Datagrid 2 tabels , i had used the JOIN Statment and the statment run fine ,
just when i wana bind the datagrid to the tabel i can't select 2 tabels at one to bind them .
i am useing this method to bind the tabel to a datagrid
Dim sqlMarkups As String
Dim ds1 As DataSet = New DataSet
Try
sqlMarkups = "The sql join statment"
Dim conSQL As New SqlClient.SqlConnection(sConn)
Dim daMarkups As New SqlClient.SqlDataAdapter(sqlMarkups, conSQL)
Dim dsMarkup As New DataSet
daMarkups.FillSchema(dsMarkup, SchemaType.Source, "tabel")
daMarkups.Fill(dsMarkup, "tabel")
grdComplaintlist.SetDataBinding(dsMarkup, "tabel")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
thxx for any help ..
-- modified at 6:04 Thursday 1st December, 2005
|
|
|
|
|
i dont know if this will help u or not.
i dont know how to use the .FillSchema but the code i am posting worked fine for me.
Dim sqlcon As New SqlConnection(constr)
Dim sqladp As New SqlDataAdapter
Dim cmdstr As New SqlCommand
Dim dsdata As New DataSet
Dim strq As String
sqlcon.Open()
strq = "SELECT C.BillNo,C.BillDate,C.Customer,P.PID,P.PName FROM BillCommonDet AS C JOIN BillProductDet AS P ON (C.BillNo = P.BillNo)"
Try
sqladp.SelectCommand = cmdstr
sqladp.SelectCommand.CommandText = strq
sqladp.SelectCommand.Connection = sqlcon
dsdata.Clear()
sqladp.Fill(dsdata, "SearchResult")
If dsdata.Tables("SearchResult").Rows.Count > 0 Then
DataGrid1.DataSource = dsdata
DataGrid1.DataMember = "SearchResult"
DataGrid1.Refresh()
End If
cmdstr.Dispose()
sqlcon.Close()
sqlcon.Dispose()
sqladp.Dispose()
Catch empexp As SqlException
MessageBox.Show(empexp.Message)
End Try
hope this is of help to you.
Regards,
Lavanya
|
|
|
|
|
I am net to VB
I am using a MS Datagrid in my application. I wish to programatically select a row in the datagrid.
If the row is visible my code works fine but i dont know how to point out to a row which is not visible in the datagrid as it has been scrolled up or down.
Bhavana
|
|
|
|
|
hi ...
I'm familiar with vb6.0 but completely newbie in vb.net...
I'm interested in learning it, of course learning Object Oriented Programming methods by it not only vb.net syntaxes....
what is your opinion...? what is my first step? please help me
Thank you very much for any suggestion
Sonia
|
|
|
|
|
Sounds like you need to absorb as much material as possible.
Regarding object oriented programming, I suggest that you read books/articles on "design patterns". This is a very valuable skill to learn. In fact, you might want to take a class on this, because I think the best way to learn it is by practicing it. It's usually taught in C++ or Java, so watch out.
In regards to VB.NET, it's not enough to just learn the new syntax. You need to learn about the .NET framework as well. I highly recommend the following book (although it's for .NET 1.1):
"Programming Microsoft Visual Basic .NET, Version 2003"
http://www.amazon.com/gp/product/0735620598/qid=1133475906/sr=1-1/ref=sr_1_1/103-3239437-9033428?s=books&v=glance&n=283155[^]
|
|
|
|
|
Also, browse through the threads on this site regularly.
|
|
|
|
|
Hello,
I made a simple Windows Form in VB.NET,
just a button, no code
because i'm new in VS2005 and was trying to see some features!
Now when trying to run this project, i get an error
"Error while trying to run project:unable to start debugging"
and now a translation of the explanation below
"the bindings entrance is invalid" ---- "de bindingsingang is ongeldig"
Don't know what to do know!
Thanks,
A.
|
|
|
|
|
just search Google for this: Error while trying to run project:unable to start debugging . There are many hits for that error most of which point to problems with the web server configuration. Maybe the type of project you are building is not a Windows application but a Web application? These are two different beasts.
...Steve
|
|
|
|
|
Hi,
need help,
I created a vb6 program that utilized the ntservices component, so that it can run in windows services, i also include a timer control so that the program will run on a specified time, BUT i setup to run at 6am in the morning, PROBLEM my program does not activate on the specified time, is this anything got to do in Windows XP environment, but when i restarted the services, then my program will run. any recommendation on how to troubleshoot this problem, many thanks
Michael
|
|
|
|
|
I have tried to re schedule it at 8am, and it works, but when i schedule it about 6am, it does not work again. hmm any recommendation how to troubleshoot this problem, i was suspecting if its got to do with the power management?
Mike
|
|
|
|
|
How are you using the Timer? Are you checking the current time every minute with it or did you sent the Interval to the difference in time between when the service starts and the target time?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, i was actually checking the time every minute, program actually should run once everyday at 6.00am. if the program checks if 6:00am or greater, then it should run some procedure.
|
|
|
|
|
6 or GREATER??? It sounds like you either don't have a flag, or are not handling the flag properly that says you executed the procedure, so you don't execute it twice in the same day. Do you have conditions that reset that flag in your code?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have checked the code, you kinda right its something to do with flag property, i think the culprit is the timer control, because once the program executed, i actually set the Timer1.Enabled = False, then forgot to turn it back on after the process has been completed.
thanks. hopefully this works.
|
|
|
|
|
I've been posting this message like crazy on several .NET boards because I'm so stumped. You have to bear with me . Anyway, I'm running into a problem when trying to use class interfaces from this library called Audiere. The library was written in C++ as virtual functions that were COM compatible. To use the interface you call a function in the DLL that returns a pointer to the interface (Factory?). They are bindings for Purebasic and Delphi that use the interfaces directly. I made a binding for the D language using interfaces that inherited from the IUnknown interface and it worked. Since .NET supports COM interop I thought this should work easily. I created the interfaces and marshaled them as IUnknown(I had to inherit from IUnknown to get it to work in D). I declared the functions in the DLL and had it return the interface. I tried to run it but it gives me a fatal error code. I tried to marshal the return type as UnmanagedType.IUnknown and UnmanagedType.Interface but it still fails. Is the interface code in .NET using a non standard vtable or something? I've included the code. Thanks.
VB Audiere Header
-----------------
'audiere.vb
Imports System.Runtime.InteropServices
Module Audiere
' <comvisible(true), comimport()=""> _
Interface RefCounted
Sub ref() ' int
Sub unref() ' int
End Interface
' <interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface File : Inherits RefCounted
Function read(ByVal pbuffer As Integer, ByVal size As Integer) As Integer ' int
Function seek(ByVal position As Integer, ByVal SeekMode As Integer) As Boolean ' bool
Function tell() As Integer ' int
End Interface
' <interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface SampleBuffer : Inherits RefCounted
Sub getFormat(ByVal channel_count As Integer, ByVal sample_rate As Integer, ByVal lsample_format As Integer) ' Sub
Function getLength() As Integer ' int
Function getSamples() As Integer ' int
Function openStream() As SampleSource ' pSampleSource
End Interface
' <interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface SampleSource : Inherits RefCounted
Sub getFormat(ByVal v As Integer, ByVal v2 As Integer) ' Sub
Function Read(ByVal v As Integer, ByVal v2 As Integer) As Integer ' int
Sub reset() ' Sub
Function isSeekable() As Boolean ' bool
Function getLength() As Integer ' int
Sub setPosition(ByVal v As Integer) ' Sub
Function getPosition() As Integer ' int
Function getRepeat() As Boolean ' bool
Sub setRepeat(ByVal v As Integer) ' Sub
End Interface
' <interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface LoopPointSource : Inherits SampleSource
Sub addLoopPoint(ByVal location As Integer, ByVal target As Integer, ByVal loopCount As Integer) ' Sub
Sub removeLoopPoint(ByVal index As Integer) ' Sub
Function getLoopPointCount() As Integer ' int
Function getLoopPoint(ByVal index As Integer, ByVal plocation As Integer, ByVal ptarget As Integer, ByVal ploopCount As Integer) As Boolean ' bool
End Interface
' <interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface OutputStream : Inherits RefCounted
Function play() As Boolean
Function _stop() As Boolean ' bool
Function isPlaying() As Boolean ' bool
Sub reset() ' Sub
Sub setRepeat(ByVal v As Boolean) ' Sub
Function getRepeat() As Boolean ' bool
Sub setVolume(ByVal v As Single) ' Sub
Function getVolume() As Single ' float
Sub setPan(ByVal v As Single) ' Sub
Function getPan() As Single ' float
Sub setPitchShift(ByVal v As Single) ' Sub
Function getPitchShift() As Single ' float
Function isSeekable() As Boolean ' bool
Function getLength() As Integer ' int
Sub setPosition(ByVal v As Integer) ' Sub
Function getPosition() As Integer ' int
End Interface
'<interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface AudioDevice : Inherits RefCounted
Sub update() ' Sub
Function openStream(ByVal pSampleSource As SampleSource) As OutputStream 'OutputStream ' pAudOutputStream
Function openBuffer(ByRef pSamples As IntPtr, ByVal frame_count As Integer, ByVal channel_count As Integer, ByVal sample_rate As Integer, ByVal sample_format As Integer) As OutputStream ' pAudOutputStream
Function getName() As String ' char.l
End Interface
<interfacetype(cominterfacetype.interfaceisiunknown)> _
Interface SoundEffect : Inherits RefCounted
Sub play() ' Sub
Sub _stop() ' Sub
Sub setVolume(ByVal volume As Single) ' Sub
Function getVolume() As Single ' float
Sub setPan(ByVal pan As Single) ' Sub
Function getPan() As Single ' float
Sub setPitchShift(ByVal shift As Single) ' Sub
Function getPitchShift() As Single ' float
End Interface
Enum SampleFormat
SF_U8 ' unsigned 8-bit integer [0,255]
SF_S16 ' signed 16-bit integer in host end Interface ianness [-32768,32767]
End Enum
Enum FileFormat
FF_AUTODETECT
FF_WAV
FF_OGG
FF_FLAC
FF_MP3
FF_MOD
FF_AIFF
End Enum
Enum SoundEffectType
SE_SINGLE
SE_MULTIPLE
End Enum
Enum SeekMode
SM_Begin
SM_Current
SM_end
End Enum
'Functions
'char* AdrGetVersion()
'char* AdrGetSupportedFileFormats()
'char* AdrGetSupportedAudioDevices()
Declare Function GetSupportedAudioDevices Lib "audiere" Alias "_AdrGetSupportedAudioDevices@0" () As String
'int AdrGetSampleSize(SampleFormat format)
'AudioDevice AdrOpenDevice(char* name = null, char* parameters = null)
Declare Function OpenDevice Lib "audiere" Alias "_AdrOpenDevice@8" (Optional ByVal name As String = Nothing, Optional ByVal parameters As String = Nothing) As AudioDevice
'SampleSource AdrOpenSampleSource(char* filename, FileFormat file_format)
'SampleSource AdrOpenSampleSourceFromFile(File file, FileFormat file_format)
'SampleSource AdrCreateTone(double frequency)
'SampleSource AdrCreateSquareWave(double frequency)
'SampleSource AdrCreateWhiteNoise()
'SampleSource AdrCreatePinkNoise()
'LoopPointSource AdrCreateLoopPointSource(SampleSource source)
'OutputStream AdrOpenSound(AudioDevice device, SampleSource source, bool streaming)
'SampleBuffer AdrCreateSampleBuffer(Sub* samples, int frame_count, int channel_count, int sample_rate, SampleFormat sample_format)
'SampleBuffer AdrCreateSampleBufferFromSource(SampleSource source)
'SoundEffect AdrOpenSoundEffect(AudioDevice device, SampleSource source, SoundEffectType type)
'File AdrOpenFile(char* name, bool writeable)
'File AdrCreateMemoryFile(Sub* buffer, int size)
End Module
--------------------
VB Test Code
--------------------
'main.vb
Module Main
Sub Main()
Dim dev As AudioDevice = OpenDevice() 'fatal error when initializing interface
'dev.getName()
Inkey()
End Sub
End Module
-- modified at 18:42 Wednesday 30th November, 2005
|
|
|
|
|
The best bet with any C++ code that needs to be called by VB.NET/C# is a C++/CLI wrapper.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi! There,
Would like to know how to create a procedure that searches for a GIF or BMP folder (i.e graphical images and photos) in the computer and open it on a form.
Thanks in advance.
Regards
Joseph
ffffffffffffffffffff
|
|
|
|
|
you can obtain a list of files that meet your needs
dim BMP() as string
BMP = Directory.GetFiles(searchpath, "*.bmp")
For opening the files, you could bind them to a picture box,
Dim MyImage as Bitmap
MyImage = New Bitmap(BMP(0))
pictureBox1.Image = CType(MyImage, Image)
of course there will need to be error checking done.
|
|
|
|